DEV Community

How should you ignore files for just you in git?

Ryan Lanciaux on September 27, 2019

No, this isn't a post about .gitignore The .gitignore file is a great way to exclude files from a repository for all users. This post is...
Collapse
 
shreyasminocha profile image
Shreyas Minocha

Oh, that's new. I thought this would be about global gitignore. Thanks!

Collapse
 
dotproto profile image
Simeon Vincent • Edited

If you commonly create files that you don't want to commit to any of your projects, you can also create a global ignore file.

$ git config --global core.excludesfile ~/.gitignore_global

For example, say you're on a Mac and you want to make sure you never commit the .DS_Store files generated by your OS, you could run the below command to add an ignore rule to your global list.

$ echo ".DS_Store" >> ~/.gitignore_global
Collapse
 
moigagoo profile image
Constantine Molchanov • Edited

Knew about this trick but it never worked for me. Added a file to .git/info/exclude but it still gets tracked.

Is there anything else that should be done?

Collapse
 
ryanlanciaux profile image
Ryan Lanciaux

Interesting- itโ€™s always worked for me when I do this. Are these files that are previously tracked?

Collapse
 
moigagoo profile image
Constantine Molchanov

Yeah, that's why I'm trying to untrack them :-)

Collapse
 
moigagoo profile image
Constantine Molchanov
Thread Thread
 
ryanlanciaux profile image
Ryan Lanciaux

Oh good! If or doesnโ€™t end up working for you, please let me know and I can try to remember what I did in the past ๐Ÿ˜ƒ

Collapse
 
hassamali profile image
Hassam Ali

Man i wanted this so badly โ™ฅ๏ธโ™ฅ๏ธโ™ฅ๏ธโ™ฅ๏ธ

Collapse
 
cescquintero profile image
Francisco Quintero ๐Ÿ‡จ๐Ÿ‡ด

๐Ÿ˜ฎ๐Ÿค”๐Ÿค”