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?
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.
.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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.