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

Default exclude rules for Git

From
Petr Baudis <pasky@suse.cz>
Date
Sep 19, 2008, 14:22 UTC
Message-ID
<20080919142211.GE10360@machine.or.cz>
In-Reply-To
<20080919050612.GA4423@roro3>
On Fri, Sep 19, 2008 at 09:06:12AM +0400, Kirill Smelkov wrote:
Show 26 quoted lines
> On Thu, Sep 18, 2008 at 03:30:35PM -0400, Daniel Barkalow wrote:
> > It's generally better to put a core.excludesfile entry in your 
> > ~/.gitconfig pointing to a ignore file with editor temporaries for the 
> > editor(s) you personally use. This will then apply to all git projects you 
> > work on.
> 
> Yes, this makes sense, thanks.
> 
> I've had to add the following to my ~/.gitconfig
> 
> [core]
>     excludesfile= /home/kirr/.gitignore-kirr
> 
> 
> because it does not work when '~' is used for $HOME
> 
> [core]
>     excludesfile= ~/.gitignore-kirr # does not work
> 
> 
> Is it intended?
> 
> 
> Still I think since a lot of people have to do the same operation, maybe
> it makes sense to put ignores for popular tools right into project's
> .gitignore.

I'm reluctant to put these universal rules to a project-specific .gitignores, that doesn't feel like the proper solution to me.

I think it would actually make most sense to insert some conservative default ignore rules to the Git's stock excludes template. (Or better, have a single file with default Git's exclude rules. Tools newly installed on the system could even add their entries there during installation as Git's quest on world dominations progresses.) I'd shamelessly propose Cogito's set of default excludes for starters:

	*.[ao]
	.*
	!.git*
	tags
	*~
	#*

(or omit the first line if that feels too C-specific - but I think it should be extremely rare to find files you _want_ to track even in non-C projects; and I'd argue anytime that by default ignoring hidden files is absolutely the sanest thing to do.)

I'm not sure if there wouldn't be opposition from others to this, though. Especially as Junio is extra-careful about backwards compatibility now after 1.6.0. :-(

-- 
				Petr "Pasky" Baudis
The next generation of interesting software will be done
on the Macintosh, not the IBM PC.  -- Bill Gates
Previous: Bert WesargNext: Junio C Hamano
Message 17 of 22 in “A couple of TopGit tweaks”
  1. Kirill SmelkovSep 18, 2008
  2. .gitignore += vim swap filesKirill Smelkov, Sep 18, 2008
  3. martin f krafftSep 18, 2008
  4. Kirill SmelkovSep 18, 2008
  5. Bert WesargSep 18, 2008
  6. Kirill SmelkovSep 18, 2008
  7. Bert WesargSep 18, 2008
  8. Kirill SmelkovSep 18, 2008
  9. martin f krafftSep 18, 2008
  10. Daniel BarkalowSep 18, 2008
  11. Kirill SmelkovSep 19, 2008
  12. Bert WesargSep 19, 2008
  13. Kirill SmelkovSep 19, 2008
  14. Andreas EricssonSep 19, 2008
  15. Kirill SmelkovSep 19, 2008
  16. Bert WesargSep 19, 2008
  17. Default exclude rules for GitPetr Baudis, Sep 19, 2008
  18. Junio C HamanoSep 19, 2008
  19. Petr BaudisSep 19, 2008
  20. Avery PennarunSep 19, 2008
  21. tg help: <something>: improve readabilityKirill Smelkov, Sep 18, 2008
  22. tg import: fix + make more robustKirill Smelkov, Sep 18, 2008

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.