From 24ba71af7ee3bfadc854b1a96b58b93cba3cf80a Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Fri, 15 Nov 2019 19:03:28 +0000 Subject: [PATCH] docs: explain shell metacharacters better It's a surprise to many users that bracket characters are treated specially in the shell, especially Windows users or other users who are not intimately familiar with the various peculiarities of shell. As a consequence, users are also surprised when putting brackets into a `git lfs track` pattern doesn't work as expected. Let's help these users out by explaining exactly what characters are special and what are ignored, since folks don't always dive into the Git attribute documentation. Let's also provide an example of tracking a file with brackets in the name to reinforce the use of the `--filename` option as well. --- docs/man/git-lfs-track.1.ronn | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/man/git-lfs-track.1.ronn b/docs/man/git-lfs-track.1.ronn index 8dbef0dd..814843c3 100644 --- a/docs/man/git-lfs-track.1.ronn +++ b/docs/man/git-lfs-track.1.ronn @@ -13,7 +13,10 @@ currently-tracked paths. The [gitattributes documentation](https://git-scm.com/docs/gitattributes) states that patterns use the [gitignore pattern rules](https://git-scm.com/docs/gitignore) -to match paths. +to match paths. This means that patterns which contain asterisk (`*`), question +mark (`?`), and the bracket characters (`[` and `]`) are treated specially; to +disable this behavior and treat them literally instead, use `--filename` or +escape the character with a backslash. ## OPTIONS @@ -66,6 +69,10 @@ to match paths. `git lfs track --lockable "*.psd"` +* Configure Git LFS to track the file named `project [1].psd`: + + `git lfs track --filename "project [1].psd"` + ## SEE ALSO git-lfs-untrack(1), git-lfs-install(1), gitattributes(5), gitignore(5).