All of lore.kernel.org
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	Emily Shaffer <emilyshaffer@google.com>,
	Jeff King <peff@peff.net>
Subject: [PATCH v4 4/5] doc: dissuade users from trying to ignore tracked files
Date: Mon, 20 Jan 2020 17:33:42 +0000	[thread overview]
Message-ID: <20200120173343.4102954-5-sandals@crustytoothpaste.net> (raw)
In-Reply-To: <20200120173343.4102954-1-sandals@crustytoothpaste.net>

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: brian m. carlson <sandals@crustytoothpaste.net>
---

Peff, since I've adopted a significant portion of what you've said here,
it's probably worth getting your sign-off on this patch.

 Documentation/git-update-index.txt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
index c7a6271daf..1489cb09a0 100644
--- a/Documentation/git-update-index.txt
+++ b/Documentation/git-update-index.txt
@@ -549,6 +549,22 @@ The untracked cache extension can be enabled by the
 `core.untrackedCache` configuration variable (see
 linkgit:git-config[1]).
 
+NOTES
+-----
+
+Users often try to use the assume-unchanged and skip-worktree bits
+to tell Git to ignore changes to files that are tracked.  This does not
+work as expected, since Git may still check working tree files against
+the index when performing certain operations.  In general, Git does not
+provide a way to ignore changes to tracked files, so alternate solutions
+are recommended.
+
+For example, if the file you want to change is some sort of config file,
+the repository can include a sample config file that can then be copied
+into the ignored name and modified.  The repository can even include a
+script to treat the sample file as a template, modifying and copying it
+automatically.
+
 SEE ALSO
 --------
 linkgit:git-config[1],

  parent reply	other threads:[~2020-01-20 17:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20 17:33 [PATCH v4 0/6] Documentation for common user misconceptions brian m. carlson
2020-01-20 17:33 ` [PATCH v4 1/5] doc: move author and committer information to git-commit(1) brian m. carlson
2020-01-20 17:52   ` Jeff King
2020-01-20 19:22     ` brian m. carlson
2020-01-21 22:24     ` Junio C Hamano
2020-01-21 22:23   ` Junio C Hamano
2020-01-20 17:33 ` [PATCH v4 2/5] docs: expand on possible and recommended user config options brian m. carlson
2020-01-20 17:33 ` [PATCH v4 3/5] doc: provide guidance on user.name format brian m. carlson
2020-01-21 22:35   ` Junio C Hamano
2020-01-20 17:33 ` brian m. carlson [this message]
2020-01-20 17:54   ` [PATCH v4 4/5] doc: dissuade users from trying to ignore tracked files Jeff King
2020-01-20 17:33 ` [PATCH v4 5/5] docs: mention when increasing http.postBuffer is valuable brian m. carlson
2020-01-20 17:55 ` [PATCH v4 0/6] Documentation for common user misconceptions Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200120173343.4102954-5-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.