Robert Benedetto
Robert Benedetto

Reputation: 1710

SourceTree not updating?

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

Answers (3)

MHK
MHK

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.

  1. just remove origin with command " git remote remove origin "

  2. 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

Melebius
Melebius

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

Kyhle Ohlinger
Kyhle Ohlinger

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:

  1. Pull Master into Master (Uncheck your branch)
  2. Pull Master into your own branch
  3. Push your own branch into your own branch

When committing your work:

  1. Commit to your own branch (Uncheck Master Branch)
  2. Push your branch to your branch
  3. Go to Master and pull Master into Master
  4. Merge your branch into Master
  5. Push Master into Master

Hopefully this helps you out

Upvotes: 0

Related Questions