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

Sourcetree adding uncommitted changes after switching branch

Elisa Erriquez May 27, 2014

Hi all,

I have noticed a problem this morning when switching branches.

After having committed ALL my changes in branch A I have switched to branch B and done a pull and a lot of changes came in.

When I switched back to A, Sourcetree showed me a lot of uncommitted changes which I think were the changes that came in from the pull in branch B.

I basically have a similar or same problem mentioned in

https://answers.atlassian.com/questions/236935/sourcetree-creates-uncommitted-changes-when-switching-branches

However nobody has answered that question.

Why does this happen? This is an error. I shouldn't be seeing all these changes from a separated branch.

I had to discard all these changes before being able to do anything else. But I can't really do this every time I switch branch.

Please let me know why this happens and how to fix it.

Regards,

Elisa

9 answers

0 votes
Yannick Forget April 17, 2019

I was using the "Embedded" version of git. I changed to "System" in the SourceTree options and I don't have this issue anymore.

Di Mikhail April 17, 2019

You mean like this?

Screenshot 2019-04-17 at 19.31.13.png

Yannick Forget April 17, 2019

Yes exactly. My embedded version of Git was too old I guess. (2.6) I also updated the embedded version and the issue is gone.

With version 2.21.0 (which is my system version), no more fake uncommited changes for me. :)

If you still have an issue with your 2.10.1 version, I suggest you try to update Git on your system.

0 votes
Di Mikhail November 6, 2018

I'm having the same problem. SourceTree v3.0

0 votes
Justin Holmes April 10, 2018

This appears to still be an issue.  Happens frequently in our environment, though not consistently.  Don't even need to have recently pushed anything as other posters have stated.  Our issue seems to be related to switching between branches where move refactors have happened.

Environment summary:

* SourceTree v2.4.8.0 (though it happened in all prior versions over the past several years as well)

* Self-hosted git repository

* Release branch #1 for the customer's in-production code.

* Release branch #2 for pre-production code ready for deployment.  This branch has a small set of move refactors vs release branch #1.

* Develop branch for current ongoing development.  This branch has a significant number of move refactors where we decomposed a larger assembly into smaller assemblies.

The issue can occur when switching between any two of the listed branches.  Normally it shows up as a bunch of uncommitted file delete changes mostly, but not always, corresponding to files that were part of a move refactor.

As a work-around we have taken to having 3 different repository clones, one for each release branch and develop to avoid the switch between branches.

0 votes
edoardocordani July 7, 2016

Same problem today, my collegue followed this pattern:

  • new branch from development branch
  • modified x files
  • commit changes to the new branch and push them
  • switch back to development
  • Sourcetree list the previous changed files as unstaged

WHY????

This is a big issue.

0 votes
Tharso Ferreira October 5, 2015

I'm having the same problem, but each time that i change of branch and pull, when i back to my old branch it shows a lot of unstaged files. It's killing the productivity, because i lose a lot of time to check all the files before to discard or merge. I love sourcetree, but became so hard to work with it that i'm stopping to using it. Now i'm doing all in the terminal, with commands, is not confortable but is safe. I will keep like this until some solution show up.

0 votes
Ron Williams March 31, 2015

I'm having the same **** problem. It seems like if I have more then one file to commit and push then switch to another branch this branch has all the uncommitted changes from the branch I just pushed. I have to discard all changes then do my merge. AHHHHH!

0 votes
Mike H March 19, 2015

I can confirm I also am having the same problem.  The pattern seems to be the following:

  1. Branch off master to a new unpublished branch
  2. Commit changes to the new branch (e.g. develop); do not push changes
  3. Switch back to master
  4. Master now shows uncommitted changes as "unstaged files."

It seems odd that SourceTree shows the files from the previous commit from a different branch as unstaged uncommitted changes.  Worse, while it is SourceTree that checks out the files, it will not undo the changes either. 

Tools that hook into Git such as Visual Studio do not show this nor do they present the files as uncommitted until I open SourceTree.

0 votes
Shomnathprabu Kasthuri December 15, 2014

I'm not able to reproduce your issue. Can u make sure Branch B is not merged with Branch A before you did pull request. Also make sure you don't have any server hook or stash which automatically merge branches

0 votes
Fred Wood August 19, 2014

Me too, I have had the same problem – thought it was me since I'm new to Sourcetree. What is happening? Why no word from the developers on this or the other thread?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events