Git allowing me to switch branches without committing changes

后端 未结 5 862
遥遥无期
遥遥无期 2021-02-03 22:40

I am just learning Git, going through a tutorial. I am in branch seo_title and I have uncommitted changes to file mission.html. I did git checkout master expecting

5条回答
  •  长情又很酷
    2021-02-03 23:10

    This is the normal behavior. If you don't want the modified files on your newly checked out branch, then stash them. Like this.

    # on branch dev
    $ git stash
    $ git checkout master
    
    # do stuff on master
    
    # back to dev
    $ git checkout dev
    $ git stash pop
    

提交回复
热议问题