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

Re: Ignored files being silently overwritten when switching branches

From
Duy Nguyen <pclouds@gmail.com>
Date
Oct 16, 2018, 15:05 UTC
Message-ID
<CACsJy8BzjrvCMzhLKmktywfpa-8_OSvmQ8A_uRv2jfMa8_MbLA@mail.gmail.com>
In-Reply-To
<871s8qdzph.fsf@evledraar.gmail.com>

On Tue, Oct 16, 2018 at 11:12 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 35 quoted lines
>
>
> On Tue, Oct 16 2018, Jeff King wrote:
>
> > On Mon, Oct 15, 2018 at 01:01:50PM +0000, Per Lundberg wrote:
> >
> >> Sorry if this question has been asked before; I skimmed through the list
> >> archives and the FAQ but couldn't immediately find it - please point me
> >> in the right direction if it has indeed been discussed before.
> >
> > It is a frequently asked question, but it doesn't seem to be in any FAQ
> > that I could find. The behavior you're seeing is intended. See this
> > message (and the rest of the thread) for discussion:
> >
> >   https://public-inbox.org/git/7viq39avay.fsf@alter.siamese.dyndns.org/
> >
> >> So my question is: is this by design or should this be considered a bug
> >> in git? Of course, it depends largely on what .gitignore is being used
> >> for - if we are talking about files which can easily be regenerated
> >> (build artifacts, node_modules folders etc.) I can totally understand
> >> the current behavior, but when dealing with more sensitive & important
> >> content it's a bit inconvenient.
> >
> > Basically: yes. It would be nice to have that "do not track this, but do
> > not trash it either" state for a file, but Git does not currently
> > support that.
>
> There's some patches in that thread that could be picked up by someone
> interested. I think the approach mentioned by Matthieu Moy here makes
> the most sense:
> https://public-inbox.org/git/vpqd3t9656k.fsf@bauges.imag.fr/
>
> I don't think the rationale mentioned by Junio in
> https://public-inbox.org/git/7v4oepaup7.fsf@alter.siamese.dyndns.org/ is
> very convincing.

Just fyi I also have some wip changes that add the forth "precious" class in addition to tracked, untracked and ignored [1]. If someone has time it could be another option to pick up.

[1] https://gitlab.com/pclouds/git/commit/0e7f7afa1879b055369ebd3f1224311c43c8a32b
-- 
Duy
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 4 of 5 in “Ignored files being silently overwritten when switching branches”
  1. Per LundbergOct 15, 2018
  2. Jeff KingOct 16, 2018
  3. Ævar Arnfjörð BjarmasonOct 16, 2018
  4. Duy NguyenOct 16, 2018
  5. Junio C HamanoOct 18, 2018

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.