Skip to content

Commit 6f02a5a

Browse files
jrngitster
authored andcommitted
Documentation: point to related commands from gitignore
A frequently asked question on #git is how to stop tracking a file that is mistakenly tracked by git. A frequently attempted strategy is to add such files to .gitignore. Thus one might imagine that the gitignore documentation could be a good entry point for 'git rm' documentation. Add some cross-references in this vein. While at it, move a reference to update-index --assume-unchanged from the DESCRIPTION to lower down on the page. This way, the methodical reader can benefit from first learning what excludes files do, then how they relate to other git facilities. Based-on-patch-by: Sitaram Chamarty <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0b803a6 commit 6f02a5a

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

Documentation/gitignore.txt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ DESCRIPTION
1414

1515
A `gitignore` file specifies intentionally untracked files that
1616
git should ignore.
17-
Note that all the `gitignore` files really concern only files
18-
that are not already tracked by git;
19-
in order to ignore uncommitted changes in already tracked files,
20-
please refer to the 'git update-index --assume-unchanged'
21-
documentation.
17+
Files already tracked by git are not affected; see the NOTES
18+
below for details.
2219

2320
Each line in a `gitignore` file specifies a pattern.
2421
When deciding whether to ignore a path, git normally checks
@@ -99,6 +96,18 @@ PATTERN FORMAT
9996
For example, "/{asterisk}.c" matches "cat-file.c" but not
10097
"mozilla-sha1/sha1.c".
10198

99+
NOTES
100+
-----
101+
102+
The purpose of gitignore files is to ensure that certain files
103+
not tracked by git remain untracked.
104+
105+
To ignore uncommitted changes in a file that is already tracked,
106+
use 'git update-index {litdd}assume-unchanged'.
107+
108+
To stop tracking a file that is currently tracked, use
109+
'git rm --cached'.
110+
102111
EXAMPLES
103112
--------
104113

@@ -142,6 +151,11 @@ Another example:
142151
The second .gitignore prevents git from ignoring
143152
`arch/foo/kernel/vmlinux.lds.S`.
144153

154+
SEE ALSO
155+
--------
156+
linkgit:git-rm[1], linkgit:git-update-index[1],
157+
linkgit:gitrepository-layout[5]
158+
145159
Documentation
146160
-------------
147161
Documentation by David Greaves, Junio C Hamano, Josh Triplett,

0 commit comments

Comments
 (0)