2

I can switch to master branch without commit any change on my own branch. And when I switch to the master branch it automatically got the changes from my own branch. It seems master branch got synchronized with my own branch automatically.

Any help would be appreciated!!!

I'm using visual studio 2017, v15.3.4

w.g.b
  • 63
  • 3
  • 1
    That's how git works. You may want `git stash`. – SLaks Sep 18 '17 at 20:16
  • 1
    Thanks @SLaks. I was not allowed to switch branches with uncommitted changes, which I think it's normal. But I do can switch branches with uncommitted changes after I updating my vs version now, which I do NOT want. That really confused me. – w.g.b Sep 18 '17 at 20:48
  • 1
    You can only switch branches if you have no uncommitted changes that conflict with the branch change. Upgrading VS does not affect git in any way. – SLaks Sep 19 '17 at 14:11
  • 1
    @SLaks, no, you can switch branches if you have uncommitted changes: when you just create a new branch or just merged your branch, and you did some change and not committed yet, then you can switch back to the original branch w/o commit your changes. You can try it. – w.g.b Sep 19 '17 at 19:37
  • 1
    Yes, unless the changes conflict. – SLaks Sep 19 '17 at 19:59
  • @w.g.b I noted that also, VS 2019 has the same behavior, before you was not allowed to change to another branch in VS if you hat un-commited changes. Now it is possible (that is the normal behavior for GIT) I personally prefer the old behavior, this new that allow to you change branch with changes easily mix code between two branch. That happen to me. who know why Microsoft do this?, maybe to be compatible with the standard GIT. I would prefer a switch or configuration setting to manager this. – freedeveloper Jun 05 '20 at 22:41

0 Answers0