git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Hilco Wijbenga <hilco.wijbenga@gmail.com>
Cc: git@vger.kernel.org, Aleem Zaki <aleemzaki@gmail.com>
Subject: Re: .gitignore is not enough
Date: Thu, 3 Aug 2023 19:17:15 +0200	[thread overview]
Message-ID: <c2fea20d-af37-8721-5bd8-14bbc3daf937@kdbg.org> (raw)
In-Reply-To: <CAE1pOi1Zt8i_rVi6dCGVsshhPxa_kV7qQ7SMu6R4nsSiadq7xw@mail.gmail.com>

Am 03.08.23 um 07:35 schrieb Hilco Wijbenga:
> I think you might be looking for "git update-index --assume-unchanged
> <file>"? See https://www.git-scm.com/docs/git-update-index for more
> details.

Sorry to tell you that this is a myth that lives on because it is
repeated over and over again.

> This allows you to tell Git to ignore the changes you made to that
> (tracked) file.

No. --assume-unchanged allows you to make the *promise* to Git that you
will not change the file, and consequently Git does not have to check
whether the file was changed. If you break the promise (because you
change it), you will get what you deserve. For example, you may find
that Git overwrites your changes, or commits them nevertheless.

Perhaps a better choice is --skip-worktree, but recent answers on
Stackoverflow point out that even that is not a suitable solution for
"please, Git, ignore these changes".

-- Hannes


  reply	other threads:[~2023-08-03 17:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03  3:23 .gitignore is not enough Aleem Zaki
2023-08-03  5:35 ` Hilco Wijbenga
2023-08-03 17:17   ` Johannes Sixt [this message]
2023-08-03 17:49     ` Hilco Wijbenga
2023-08-03 20:27       ` Johannes Sixt
2023-08-03 21:53         ` Junio C Hamano
2023-08-03 21:38     ` brian m. carlson
2023-08-03 21:47       ` Aleem Zaki

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=c2fea20d-af37-8721-5bd8-14bbc3daf937@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=aleemzaki@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hilco.wijbenga@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).