Re: git overwriting local ignored files?
- From
David Mandelberg <david@mandelberg.org>
- Date
- Nov 24, 2018, 14:37 UTC
- Message-ID
- <7ac49733-2e62-7d29-36aa-99df4124b54c@mandelberg.org>
- In-Reply-To
- <xmqqftvr2jfo.fsf@gitster-ct.c.googlers.com>
On 11/23/18 11:22 PM, Junio C Hamano wrote:
Show 11 quoted lines
> David Mandelberg <david@mandelberg.org> writes: > >> It seems that git is overwriting my local files on merge if they're in >> .gitignore. See command transcript below. I searched `git help config` >> and Google, but I couldn't find any way to prevent it. Am I missing >> something? (The reason I care about ignored files is that I'm using >> git with a working directory of $HOME to manage my dotfiles, and most >> files in my $HOME are not tracked by git but are still important.) > > The .gitignore file is to list "ignored and expendable" class of > files; there is no "ignored but precious class" in Git.
Ok. Would a patch be welcome? I have three ideas for how to implement it, and I'm not sure which is better.
1. Add a boolean config option called core.preserveIgnore (or similar). I'm guessing this is the least amount of work, but it's not very flexible. I'm also not sure how it should work with `git clean`.
2. Add some syntax to the .gitignore format so the same file can list both "ignored and expendable" and "ignored and precious". I could see using this to mark compiled files as ignored+expendable and per-repo editor/IDE config files as ignored+precious. Do you have any idea how big of a patch this would be? Or any idea for the new syntax? I think starting a line with "\x" where x is any character not currently escaped by a backslash would cause the least disruption to existing .gitignore files.
3. Like (2), but use a separate file instead of .gitignore (and the other git-ignore files).
Any thoughts?
-- https://david.mandelberg.org/