git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: David Mandelberg <david@mandelberg.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: git overwriting local ignored files?
Date: Sat, 24 Nov 2018 09:37:06 -0500	[thread overview]
Message-ID: <7ac49733-2e62-7d29-36aa-99df4124b54c@mandelberg.org> (raw)
In-Reply-To: <xmqqftvr2jfo.fsf@gitster-ct.c.googlers.com>

On 11/23/18 11:22 PM, Junio C Hamano wrote:
> 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/

  reply	other threads:[~2018-11-24 14:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-24  2:35 David Mandelberg
2018-11-24  4:22 ` Junio C Hamano
2018-11-24 14:37   ` David Mandelberg [this message]
2018-11-24 14:57     ` Konstantin Khomoutov
2018-11-24 15:41       ` Konstantin Khomoutov
2018-11-25  2:06         ` David Mandelberg

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=7ac49733-2e62-7d29-36aa-99df4124b54c@mandelberg.org \
    --to=david@mandelberg.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --subject='Re: git overwriting local ignored files?' \
    /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

Code repositories for project(s) associated with this 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).