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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

426 views 0 1
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