0

Ive recently swithced from SVN to GIT so maybe Im not understanding properly, but I have two branches. Master and we'll call the other one NewFeature. NewFeature is a branch off Master and is the branch I have been working on. I made several changes to existing files and added new files. In Eclipse I wanted to switch back to Master to see old code so in Eclipse I went to the Git view, right clicked Master under branches and selected "Checkout". Master is now selected with a check mark. I refreshed the project even but all the changes I made to NewFeature are still there and the new files exist in the project as well.

Am I missing something? Is this expected behavior?

fubar92
  • 85
  • 1
  • 8
  • Just a note : if your "Master Origin" name here is just a placeholder to help the explanation, *please* use another name, as it's unnecessarily confusing, given that `master` is the most used name for the main branch and `origin` the default name for the remote from which a repo is cloned... If, however, this **is** your real name, well... let's hope it's not the case. – Romain Valeri Apr 22 '20 at 20:00
  • Sorry, it is just called Master. – fubar92 Apr 22 '20 at 20:03
  • 1
    I'll sleep a lot better now :-) – Romain Valeri Apr 22 '20 at 20:05
  • 1
    If you didn't do a commit, then yes, that is the expected behavior. – howlger Apr 22 '20 at 22:23

1 Answers1

0

You will need to commit your changes to this feature branch before your checkout master. Right now all this changes are in your working directory. They will go wherever you will go UNLESS you commit them to a branch.

Karan Dhillon
  • 1,186
  • 1
  • 6
  • 14