Sourcetree Version 2.1.2.5
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?
Dave
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?
Best regards,
Ana
Hi Ana,
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:
db_objects/emp_change.pls
Please commit your changes or stash them before you switch branches.
Aborting
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.
Dave
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dave, that's weird, for my previous example I used only the command line git, I was not using SourceTree. Which git version are you using? I have git version 2.11.0 (Apple Git-81).
Regards,
Ana
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.