From 0b803a6cc679e5448330ddb3ed3ace3cd66f1b31 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Wed, 10 Nov 2010 12:57:39 -0600 Subject: Documentation: split gitignore page into sections A learner-by-example might want to look at the examples section first. Help her out by supplying some section headings: PATTERN FORMAT for the format of lines in an excludes file and EXAMPLES for the two examples. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/gitignore.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Documentation') diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt index 7dc2e8b0b..254bc1ac2 100644 --- a/Documentation/gitignore.txt +++ b/Documentation/gitignore.txt @@ -62,7 +62,8 @@ files specified by command-line options. Higher-level git tools, such as 'git status' and 'git add', use patterns from the sources specified above. -Patterns have the following format: +PATTERN FORMAT +-------------- - A blank line matches no files, so it can serve as a separator for readability. @@ -98,7 +99,8 @@ Patterns have the following format: For example, "/{asterisk}.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". -An example: +EXAMPLES +-------- -------------------------------------------------------------- $ git status -- cgit v1.2.1 From 6f02a5a33a3983597992e94c7b826021acc8a9d9 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Wed, 10 Nov 2010 13:00:48 -0600 Subject: 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 Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/gitignore.txt | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'Documentation') diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt index 254bc1ac2..8416f3445 100644 --- a/Documentation/gitignore.txt +++ b/Documentation/gitignore.txt @@ -14,11 +14,8 @@ DESCRIPTION A `gitignore` file specifies intentionally untracked files that git should ignore. -Note that all the `gitignore` files really concern only files -that are not already tracked by git; -in order to ignore uncommitted changes in already tracked files, -please refer to the 'git update-index --assume-unchanged' -documentation. +Files already tracked by git are not affected; see the NOTES +below for details. Each line in a `gitignore` file specifies a pattern. When deciding whether to ignore a path, git normally checks @@ -99,6 +96,18 @@ PATTERN FORMAT For example, "/{asterisk}.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". +NOTES +----- + +The purpose of gitignore files is to ensure that certain files +not tracked by git remain untracked. + +To ignore uncommitted changes in a file that is already tracked, +use 'git update-index {litdd}assume-unchanged'. + +To stop tracking a file that is currently tracked, use +'git rm --cached'. + EXAMPLES -------- @@ -142,6 +151,11 @@ Another example: The second .gitignore prevents git from ignoring `arch/foo/kernel/vmlinux.lds.S`. +SEE ALSO +-------- +linkgit:git-rm[1], linkgit:git-update-index[1], +linkgit:gitrepository-layout[5] + Documentation ------------- Documentation by David Greaves, Junio C Hamano, Josh Triplett, -- cgit v1.2.1