Skip to content

Commit 1b13e90

Browse files
bk2204gitster
authored andcommitted
doc: dissuade users from trying to ignore tracked files
It is quite common for users to want to ignore the changes to a file that Git tracks. Common scenarios for this case are IDE settings and configuration files, which should generally not be tracked and possibly generated from tracked files using a templating mechanism. However, users learn about the assume-unchanged and skip-worktree bits and try to use them to do this anyway. This is problematic, because when these bits are set, many operations behave as the user expects, but they usually do not help when git checkout needs to replace a file. There is no sensible behavior in this case, because sometimes the data is precious, such as certain configuration files, and sometimes it is irrelevant data that the user would be happy to discard. Since this is not a supported configuration and users are prone to misuse the existing features for unintended purposes, causing general sadness and confusion, let's document the existing behavior and the pitfalls in the documentation for git update-index so that users know they should explore alternate solutions. In addition, let's provide a recommended solution to dealing with the common case of configuration files, since there are well-known approaches used successfully in many environments. Signed-off-by: Jeff King <[email protected]> Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2323784 commit 1b13e90

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Documentation/git-update-index.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,22 @@ The untracked cache extension can be enabled by the
549549
`core.untrackedCache` configuration variable (see
550550
linkgit:git-config[1]).
551551

552+
NOTES
553+
-----
554+
555+
Users often try to use the assume-unchanged and skip-worktree bits
556+
to tell Git to ignore changes to files that are tracked. This does not
557+
work as expected, since Git may still check working tree files against
558+
the index when performing certain operations. In general, Git does not
559+
provide a way to ignore changes to tracked files, so alternate solutions
560+
are recommended.
561+
562+
For example, if the file you want to change is some sort of config file,
563+
the repository can include a sample config file that can then be copied
564+
into the ignored name and modified. The repository can even include a
565+
script to treat the sample file as a template, modifying and copying it
566+
automatically.
567+
552568
SEE ALSO
553569
--------
554570
linkgit:git-config[1],

0 commit comments

Comments
 (0)