threads / discuss / 19628

"exclude" and ".gitignore" for everyone

Subject: "exclude" and ".gitignore" for everyone

## tl;dr

4 messages between Jun 1, 2009 and Jun 1, 2009.

replies: 3people: 3as markdown or json

Nikos Chantziaras· Jun 1, 2009, 13:46 UTC · lore
Hello.

I'm a first-time Git user. I found out how to ignore files with Git. For example I've put "*.[oa]" and "*~" in ./git/info/exclude. However, the rest of the persons doing commits in the public repository might not have those entries. Is everyone required to put those entries in "exclude" themselves or does Git allow for those to be automatically added next time they do a "git pull"?

Brian Gernhardt· Jun 1, 2009, 13:58 UTC · re: Nikos Chantziaras · lore

Re: "exclude" and ".gitignore" for everyone

On Jun 1, 2009, at 9:46 AM, Nikos Chantziaras wrote:
Show 6 quoted lines
> I'm a first-time Git user.  I found out how to ignore files with  
> Git. For example I've put "*.[oa]" and "*~" in ./git/info/exclude.   
> However, the rest of the persons doing commits in the public  
> repository might not have those entries.  Is everyone required to  
> put those entries in "exclude" themselves or does Git allow for  
> those to be automatically added next time they do a "git pull"?

If you commit a .gitignore, it will be used by everyone. .git/info/ exclude is for your personal excludes. Generally, I'd suggest putting build products in .gitignore and your editor's garbage in exclude. For example:

project/.gitignore: ------------------- *.o *.a random.tmp

project/.git/info/exclude: -------------------------- .*.swp *~ /my-todo.txt

If you add and commit the .gitignore file it will be picked up by everyone, while whatever backups, temp files, notes, or whatever you use can be kept private in your exclude file.

~~ Brian
Nikos Chantziaras· Jun 1, 2009, 14:16 UTC · re: Brian Gernhardt · lore

Re: "exclude" and ".gitignore" for everyone

Brian Gernhardt wrote:
Show 16 quoted lines
> On Jun 1, 2009, at 9:46 AM, Nikos Chantziaras wrote:
>> [...]
>> For example I've put "*.[oa]" and "*~" in ./git/info/exclude.  
>> However, the rest of the persons doing commits in the public 
>> repository might not have those entries.  Is everyone required to put 
>> those entries in "exclude" themselves or does Git allow for those to 
>> be automatically added next time they do a "git pull"?
> 
> If you commit a .gitignore, it will be used by everyone.  
> .git/info/exclude is for your personal excludes.  Generally, I'd suggest 
> putting build products in .gitignore and your editor's garbage in 
> exclude.
> [...]
> If you add and commit the .gitignore file it will be picked up by 
> everyone, while whatever backups, temp files, notes, or whatever you use 
> can be kept private in your exclude file.
Thanks, Brian!
Matthieu Moy· Jun 1, 2009, 14:36 UTC · re: Brian Gernhardt · lore

Re: "exclude" and ".gitignore" for everyone

Brian Gernhardt <benji@silverinsanity.com> writes:
>  Generally, I'd suggest putting [...] your editor's garbage in
> exclude.
better: put them in a user-wide ignore file.
in ~/.gitconfig:
[core]
        excludesfile = /home/yourlogin/.gitignore
then put whatever you want in $HOME/.gitignore.
-- 
Matthieu

← back to recent threads