Reputation: 1710
I have just started using SourceTree for one of my ASP.NET projects. All things started out fine, but now I have noticed that if I create a new branch form the MASTER branch (lets call it NEWBRANCH), make some changes to it, and then switch back (CHECKOUT) my MASTER branch, the source code remains the same in Visual Studio? Of course, I would expect it to revert back to the original code since I'm back in MASTER? But I still see the changes that were made in NEWBRANCH?
And I have tried shutting down VS and reopening. No go. Can anyone shed some light on this?
Upvotes: 0
Views: 10873
Reputation: 489
Actually this happens when you update OS version or some updates from os vendor. I was having same problem in sourcetree and tower. if you facing some authentication fatal error then just go to terminal and change directory to git repo.
just remove origin with command " git remote remove origin "
add origin with command "git remote add origin https://{username}:{password}@github.com/{username}/project.git" . OR "git remote add origin https://{username}@github.com/{username}/project.git"
after that for confirmation you can use command git remote -v
after fetching if head branch/tracked branch is not updating status then . remove branch from tracking and create tracking again and check. I hope this time everything will be work fine.
Thanks....
Upvotes: 1
Reputation: 6695
Uncommitted changes don’t belong to any branch. Once you commit the changes to the NEWBRANCH and then switch to MASTER, the changes will be overwritten in the working tree and kept in Git as a part of NEWBRANCH.
When you are not ready to commit the changes, you can stash them before switching the branch.
Upvotes: 0
Reputation: 172
With SourceTree the problem is that your code is saved as a local copy, whereas the "MASTER" branch itself hasn't been updated, so the purpose is to be able to work on your own "NEWBRANCH" and not change the "MASTER". If you Don't want the changes to show, you have to not commit your changes to "MASTER" and then do a roll back so that you have you old code saved.
This is what helped me initially when i started out with sourceTree:
When you open sourceTree:
When committing your work:
Hopefully this helps you out
Upvotes: 0