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

Re: gitignore design

From
Jakub Narebski <jnareb@gmail.com>
Date
Jul 29, 2011, 12:19 UTC
Message-ID
<m339hps2is.fsf@localhost.localdomain>
In-Reply-To
<1311940877783-6633274.post@n2.nabble.com>
llucianf <llucianf@gmail.com> writes:
> Ferry Huberts <mailings@hupie.com> writes:
> > On 07/29/2011 12:20 PM, llucianf wrote:
> > > why gitignore doesnt simply work like in cvs where if you put something in
> > > the ignore file, those stuff are simply ignored from that point without
> > > having to remove them from repo?

Are you sure that cvsignore file makes CVS to ignore changes in _tracked_ files (in repository)? CVS manual says:

  Ignoring files via cvsignore
  ============================
     There are certain file names that frequently occur inside your
  working copy, but that you don't want to put under CVS control.
  Examples are all the object files that you get while you compile your
  sources.  Normally, when you run `cvs update', it prints a line for
  each file it encounters that it doesn't know about.
Tracked files (in repository) are by definition not unknown to version
control system, be it CVS or Git.
 
Show 7 quoted lines
> > because when it's in the repo you obviously want to track it...
> > tracking trumps ignoring
> > 
> > if you now suddenly do not want to track it anymore you have to remove
> > it and ignore it.
>
> sorry but this is not always the case.

But it is _usually_ the case, and that is why gitignore works as it does, being only about _untracked_ files.

>                                        there are plenty of cases (project
> files is most common example) in which i need files in repo but i do not
> need git to track them. so why i cant just simply enumerate those project
> files into .gitignore and 'persuade'  git to simply forget about them?

For that you can use 'assume-unachanged' mechanism (note: it is local to repository). The gitignore(7) manpage says:

  NOTES
     The purpose of gitignore files is to ensure that certain files not tracked
     by git remain untracked.
     To ignore uncommitted changes in a file that is already tracked, use
     `git update-index --assume-unchanged <file>`.
Or just don't use 'git commit -a' and commit with dirty tree.
-- 
Jakub Narębski
Previous: Ferry HubertsNext: Johannes Sixt
Message 10 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.