Code

Documentation: How to ignore local changes in tracked files
authorPetr Baudis <pasky@suse.cz>
Fri, 18 Jul 2008 14:11:07 +0000 (16:11 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 19 Jul 2008 18:17:43 +0000 (11:17 -0700)
This patch explains more carefully that `.gitignore` concerns only
untracked files and refers the reader to

git update-index --assume-unchanged

in the need of ignoring uncommitted changes in already tracked files.
The description of this option is lifted to a more "porcelainish"
level and explains the caveats of this usecase.

Whether feasible or not, I believe adding this functionality to
the porcelain is out of the scope of this patch. (And I personally
think that referring to the plumbing in the case of such a special
usage is fine.)

This is currently probably one of the top FAQs at #git and the
--assume-unchanged switch is not widely known; gitignore(5) is the first
place where people are likely to look for it.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-update-index.txt
Documentation/gitignore.txt

index a91fd214d2246b6fbf20543a8d285f619ecd7e58..6b930bc16303e6a17554a551badfe01febaf3ca1 100644 (file)
@@ -88,6 +88,16 @@ OPTIONS
        sometimes helpful when working with a big project on a
        filesystem that has very slow lstat(2) system call
        (e.g. cifs).
++
+This option can be also used as a coarse file-level mechanism
+to ignore uncommitted changes in tracked files (akin to what
+`.gitignore` does for untracked files).
+You should remember that an explicit 'git add' operation will
+still cause the file to be refreshed from the working tree.
+Git will fail (gracefully) in case it needs to modify this file
+in the index e.g. when merging in a commit;
+thus, in case the assumed-untracked file is changed upstream,
+you will need to handle the situation manually.
 
 -g::
 --again::
index fc0efd8ec8dcc791c528d0eca362172f7e445164..59321a2e82b1e141746d94c439452b52b84994ad 100644 (file)
@@ -13,9 +13,14 @@ DESCRIPTION
 -----------
 
 A `gitignore` file specifies intentionally untracked files that
-git should ignore.  Each line in a `gitignore` file specifies a
-pattern.
-
+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.
+
+Each line in a `gitignore` file specifies a pattern.
 When deciding whether to ignore a path, git normally checks
 `gitignore` patterns from multiple sources, with the following
 order of precedence, from highest to lowest (within one level of