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): https://confidentialfiles.wordpress.com/2010/06/02/a-quick-way-to-delete-all-files-with-a-certain-name-pattern-in-windows/

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 Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

261 views 0 3
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot