gitignore and XML/IMI files

I've added *.xml and *.iml to my gitignore_global.txt file, but those files still appear in the Unstaged Files list. Other file types in the gitignore_global.txt file (e.g. *.pyc) that I've added manually do not appear. What is causing this behavior, and is there a way to fix it?

I'm using SourceTree v 1.6.18.0, but the problem has been around for some time. 

1 answer

.gitignore will only effect un-indexed files.

If there are .xml or .iml files that are already part of your repository, there is not a practical way that I know of to force SourceTree to ignore changes to those files besides removing them from the repository.

Thanks for the rapid response, much appreciated. My follow up question is how did these XML/IMI files get added to the repository in the first place? I didn't add them. They're created by PyCharm in the .idea folder it uses for configuration stuff, and they just appear in the list of Unstaged Files.

I've tried removing them from the repository before, but they just keep reappearing. Is there a way to stop this happening?

Have they been added by another user? You should be able to review your commit history and find the commits where they were added.

Thanks. That was the answer.

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 ...

270 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