Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Sourcetree trying to stage ignored files

Coleman Horton January 12, 2023

I started up sourcetree yesterday and found that it was suddenly trying to stage thousands of previously untracked files from directories that are in my .gitignore.

I have no idea what caused this - I haven't made any changes to Sourcetree or my .gitignore file.  When I try to select the offending files to ignore them Sourcetree hangs indefinitely.

This is not the first time something like this has happened.  Why does Sourcetree randomly decide to disregard my .gitignore?  Are there any plans to make the interface remain usable when there are thousands of unstaged files?  How can I get Sourcetree to start ignoring these files again?

1 answer

0 votes
Coleman Horton January 13, 2023

I was able to remove some of these files with the following command:
git ls-files -c --ignored --exclude-standard -z | xargs -0 git rm --cached
git commit -am "Remove ignored files"

However, there were still thousands of files marked with a purple question mark that I had to remove manually using right click --> Ignore --> Ignore all files under...

Why does Sourcetree not respect my gitignore settings? If I go to Repository Settings --> Advanced --> Repository-specific ignore list --> Edit; it correctly opens my gitignore file - so clearly Sourcetree is aware of the gitignore file.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events