Sourcetree Version 22.214.171.124
I make changes in a branch, and forget to commit them (am new to git so haven't gotten into the habit).
I then use Source tree to switch to the next branch, which it quite hapily does.
I then find the code is exactly what it was with the other, uncommitted changes. Very confusing.
I then switched to the command line and tried a "git checkout" to the other repository and git wouldn't let me do it, saying there are uncommitted changes.
Why does Sourcetree allow it?
Hi Dave, I'm not sure I understand the problem you describe. I've tried to reproduce it using Git in the terminal and I've been able to switch to different branches even if I didn't commit my changes. Here's what I did:
Are those the steps you followed? If you're still having issues, can you clarify a bit more?
That is exactly the problem.
Sourcetree allows you to switch branches without committing your changes. Git does not. If at step 3 you try using command line git commands to checkout branch 2, it will not let you.
the git command and it's output is
C:\a_check>git checkout 02926D-A_add_comments_only
error: Your local changes to the following files would be overwritten by checkout:
Please commit your changes or stash them before you switch branches.
Sourcetree allows the checkout to 02926D thus confusing you over what changes are actually in the directory.
I did notice that if the changes are from a conflicted merge, Sourcetree will not allow the switch.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...
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!
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