Skip to content

Commit c9bfdf1

Browse files
committed
Documentation: describe .gitlocalignore and core.gitLocalIgnore
Document the new root-level, local-only ignore file and its core.gitLocalIgnore switch, including precedence and the fact that the file is self-excluding and never tracked. Signed-off-by: Shanthosh <shanthubolt@gmail.com>
1 parent 3a08955 commit c9bfdf1

2 files changed

Lines changed: 29 additions & 5 deletions

File tree

Documentation/config/core.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,15 @@ core.excludesFile::
493493
If `$XDG_CONFIG_HOME` is either not set or empty, `$HOME/.config/git/ignore`
494494
is used instead. See linkgit:gitignore[5].
495495

496+
core.gitLocalIgnore::
497+
If set to `true`, Git additionally reads ignore patterns from
498+
a file named `.gitlocalignore` at the root of the working tree.
499+
This file is meant for machine-local, uncommitted ignore rules:
500+
it is ignored by Git itself (self-excluding) and is never tracked.
501+
Its patterns are applied with lower precedence than
502+
`.git/info/exclude` but higher than `core.excludesFile`.
503+
Defaults to `false`. See linkgit:gitignore[5].
504+
496505
core.askPass::
497506
Some commands (e.g. svn and http interfaces) that interactively
498507
ask for a password can be told to use an external program given

Documentation/gitignore.adoc

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gitignore - Specifies intentionally untracked files to ignore
77

88
SYNOPSIS
99
--------
10-
$XDG_CONFIG_HOME/git/ignore, $GIT_COMMON_DIR/info/exclude, .gitignore
10+
$XDG_CONFIG_HOME/git/ignore, $GIT_COMMON_DIR/info/exclude, .gitignore, .gitlocalignore
1111

1212
DESCRIPTION
1313
-----------
@@ -34,10 +34,17 @@ precedence, the last matching pattern decides the outcome):
3434
includes such `.gitignore` files in its repository, containing patterns for
3535
files generated as part of the project build.
3636

37-
* Patterns read from `$GIT_COMMON_DIR/info/exclude`.
37+
* Patterns read from `$GIT_COMMON_DIR/info/exclude`.
3838

39-
* Patterns read from the file specified by the configuration
40-
variable `core.excludesFile`.
39+
* Patterns read from a `.gitlocalignore` file at the root of the
40+
working tree, but only when the `core.gitLocalIgnore` configuration
41+
variable is enabled (it is `false` by default). This file is intended
42+
for machine-local, uncommitted ignore rules: Git ignores the file
43+
itself (self-excluding) and never tracks it. Its precedence is below
44+
`$GIT_COMMON_DIR/info/exclude` but above `core.excludesFile`.
45+
46+
* Patterns read from the file specified by the configuration
47+
variable `core.excludesFile`.
4148

4249
Which file to place a pattern in depends on how the pattern is meant to
4350
be used.
@@ -57,7 +64,15 @@ be used.
5764
the user's editor of choice) generally go into a file specified by
5865
`core.excludesFile` in the user's `~/.gitconfig`. Its default value is
5966
$XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or
60-
empty, $HOME/.config/git/ignore is used instead.
67+
empty, $HOME/.config/git/ignore is used instead.
68+
69+
* Patterns which apply only to your local machine and which you do
70+
not want to share or commit (e.g., paths that exist only in your
71+
checkout) can go into a `.gitlocalignore` file at the root of the
72+
working tree, once `core.gitLocalIgnore` is enabled. Unlike the
73+
other files above, `.gitlocalignore` is ignored by Git itself and
74+
will never be tracked or pushed.
75+
6176

6277
The underlying Git plumbing tools, such as
6378
'git ls-files' and 'git read-tree', read

0 commit comments

Comments
 (0)