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

Re: gitignore design

From
Clemens Buchacher <drizzd@aon.at>
Date
Jul 30, 2011, 16:01 UTC
Message-ID
<20110730160124.GA7545@toss.lan>
In-Reply-To
<CACsJy8DcFJUK91cJm3EmHn8BMyA78gzu_pMtqJ0z9oO1RF+suw@mail.gmail.com>
On Sat, Jul 30, 2011 at 08:22:14PM +0700, Nguyen Thai Ngoc Duy wrote:
Show 10 quoted lines
> On Sat, Jul 30, 2011 at 1:45 PM, Piotr Krukowiecki
> <piotr.krukowiecki@gmail.com> wrote:
> > I was using assume-unchanged for some time but stopped after some
> > weird problems during updates. I'm not sure if this was caused by this
> > or by sparse-checkout (and I use git-svn too). Anyway, after stopping
> > using assume-unchanged and sparse-checkout mysterious problems
> > disappeared.
> 
> I'm interested in the problems you had (even better if you found a way
> to reproduce).
Hi, Same here.

Concerning the OP's question, I've also written this FAQ entry, which explains two methods to deal with the problem:

 https://git.wiki.kernel.org/index.php/GitFaq#How_do_I_tell_git_to_ignore_tracked_files.3F

It also mentions assume-unchanged and sparse checkout as a third option, but it warns that these features were not designed for that purpose. Apart from the bug fixed in aecda37 I have never had a problem with them myself. But it's not a particularly convenient solution in any case.

As far as a possible 'exclude untracked' mechanism is concerned, I am not sure that is a good thing to have. It's like saying "I want to track changes to those files, but I do not want to commit changes by default (e.g. commit -a, add -u etc.)." That may sound reasonable at first, but I think the desire to ignore changes to tracked files usually indicates a design problem. And it can almost always be solved using either option (a) or (b) from the FAQ entry above.

On the other hand, such a feature bears some risk. The repository is not guaranteed to be in a certain state, even if git status is empty. You could still have ignored changes somewhere. And it's all too easy to forget about those. I know I always forget about the rules I have in my .git/info/exclude.

Maybe I should not be trying to protect users from shooting themselves in the foot. But I would be very curious to hear from the OP why options (a) or (b) above are not a solution for his use case, before adding yet another "dangerous" mechanism to git.

Clemens
Previous: Piotr KrukowieckiNext: Philip Oakley
Message 19 of 20 in “gitignore design”
  1. llucianfJul 29, 2011
  2. Ferry HubertsJul 29, 2011
  3. llucianfJul 29, 2011
  4. Ferry HubertsJul 29, 2011
  5. llucianfJul 29, 2011
  6. Jakub NarebskiJul 29, 2011
  7. llucianfJul 29, 2011
  8. Jakub NarebskiJul 29, 2011
  9. Ferry HubertsJul 29, 2011
  10. Jakub NarebskiJul 29, 2011
  11. Johannes SixtJul 29, 2011
  12. Jakub NarebskiJul 29, 2011
  13. Johannes SixtJul 29, 2011
  14. Jakub NarebskiJul 29, 2011
  15. Nguyen Thai Ngoc DuyJul 30, 2011
  16. Piotr KrukowieckiJul 30, 2011
  17. Nguyen Thai Ngoc DuyJul 30, 2011
  18. Piotr KrukowieckiJul 30, 2011
  19. Clemens BuchacherJul 30, 2011
  20. Philip OakleyJul 29, 2011

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.