git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] Documentation: point to related commands from gitignore

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Nov 10, 2010, 19:00 UTC
Message-ID
<20101110190048.GC12365@burratino>
In-Reply-To
<20101110185555.GA12365@burratino>

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 <sitaram@atc.tcs.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 This NOTES section is a bit of a placeholder.  I think it is an
 improvement already, but if someone wants to flesh it out I wouldn't
 complain.
 Hope that helps.
 Documentation/gitignore.txt |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index 254bc1a..8416f34 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,
-- 
1.7.2.3.557.gab647.dirty
Previous: Jonathan NiederNext: Junio C Hamano
Message 3 of 5 in “Re: [PATCH] gitignore(5): explain how to stop tracking a file”
  1. Jonathan NiederNov 10, 2010
  2. 1/2 Documentation: split gitignore page into sectionsJonathan Nieder, Nov 10, 2010
  3. 2/2 Documentation: point to related commands from gitignoreJonathan Nieder, Nov 10, 2010
  4. Junio C HamanoNov 11, 2010
  5. Sitaram ChamartyNov 11, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.