Sourcetree started tracking thumbs.db

I don't know what I did or If I did it but Sourcetree has suddenly started tracking thumbs.db files in all my repositories. I don't know if Windows was not generating thumbs.db previously or sourcetree was never tracking them, but this time, they're everywhere.

It's not possible to remove all of them individually because every folder has it and gitignore will only work for repositories created in the future. What do I do about the old repositories?

2 answers

.gitignore works on current and future commits in any repository.

However, .gitignore only affects files that aren't already being tracked.

Definitely add thumbs.db to your .gitignore, but you'll also need to delete all the thumbs.db files and commit that. You might try this solution (make sure to back up the repo first just in case):

After you've committed the deletion AND added thumbs.db to your gitignore, the thumbs.db files should no longer show up in SourceTree, even if Windows re-creates them.

How many commits back do you have to go to find a commit state that does not contain a thumbs.db file?

You could make a new branch at that commit, then cherry pick the next commit (which would be the one where you first accidentally started tracking the thumbs.db file), then delete thumbs.db and commit but choose to amend the previous commit, all commits after that (unless the thumbs.db file changed in those also) should be able to cleanly cherry pick over to your new branch. Then delete the old branch and rename the new branch with the name of the old branch.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,224 views 4 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you