Bringing my git-ignore settings with me

Since I’m working a lot of different places, and on quite a few different computers, I need to reconfigure my git-ignore settings every now and then. To manage my settings, I’ve put my git excludes in my Dropbox folder. This gives med the added advantage that all ignore settings are automatically syncronized between computers.

This is the file I have in Dropbox:


bin/
obj/
*.user
*.suo
_ReSharper.*/

And this is how git status looks like if I don’t use the ingore file:

Git notifies me that the Visual Studio build output and local settings are in the repository but are untracked. As my solutions grow, this list can grow to be very big.

I run this statement in git bash, pointing to my dropbox folder on my D: drive. This should work from Windows Command Line too, but then you need to use the Windows path

git config --global core.excludesfile /d/Dropbox/git/excludes

Note that it’s important to use the –global flag to make it valid for all local repositories, as this makes the command store the setting in the .gitconfig in your HOME folder.
When I now run git status, all the local files and settings from Visual Studio is now ignored:



Legg igjen et svar

Fyll inn i feltene under, eller klikk på et ikon for å logge inn:

WordPress.com-logo

Du kommenterer med bruk av din WordPress.com konto. Log Out / Endre )

Twitter picture

Du kommenterer med bruk av din Twitter konto. Log Out / Endre )

Facebookbilde

Du kommenterer med bruk av din Facebook konto. Log Out / Endre )

Kobler til %s

Følg med

Få nye innlegg levert til din innboks.

Bli med 140 andre følgere