I am using SourceTree for my GIT repositories.
Today I need to ignore some files; when I added these files to ignore list from SourceTree's "Ignore file" menu and check local .gitignore file, the ignored files are not listed there. Instead these are listed in the global .gitignore.
How can I get SourceTree to add the files to the repository-specific .gitignore?
Easiest way to edit the individual, is right click the file. Click Ignore and select the option to ignore just in this repository then you will see a new file called . gitignore in the list.
Normally yes, . gitignore is useful for everyone who wants to work with the repository. On occasion you'll want to ignore more private things (maybe you often create LOG or something. In those cases you probably don't want to force that on anyone else.
When you choose to ignore a file that is modified etc, SourceTree will bring up the following dialogue:
Instead of choosing the "global ignore list", select the "this repository only" option.
Easiest way to edit the individual, is right click the file. Click Ignore and select the option to ignore just in this repository then you will see a new file called .gitignore in the list.
If you have accidentally already added them to the list. You can delete them by going to Sourcetree - > Preferences -> Git menu option. See below.
As a quick tip - I find that github has a great selection of starter github ignore files which I find really useful to start a new project
Eg: https://github.com/github/gitignore
In my case, at some point in time, Sourcetree started using the gitconfig from C:\Program Files\Git\mingw64\etc\gitconfig instead of using C:\Users\yourUser.gitconfig.
Once I added the following line in this gitconfig, it resolved my issue on Sourcetree:
[core]
safecrlf = false
excludesfile = C:\\Users\\<YOUR_USER>\\Documents\\gitignore_global.txt
Please note that on my side the global ignore setting from Tools/Option/Git/ does not seemed to be considered by Sourcetree, therefore I don't even need to change it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With