git: switch branch without detaching head

后端 未结 4 1666
野趣味
野趣味 2020-11-28 18:38

I have a repository on github with a main branch (master) and a branch for some experimental work. I made some commits and pushed to the experimental branch and everything

4条回答
  •  我在风中等你
    2020-11-28 19:21

    git clone git@github.com:abc/def.git
    cd def
    

    Now create a tracking branch:

    git branch --track experimental origin/experimental
    git checkout experimental
    

    Then, after working there, simply push to github by

    git push
    

提交回复
热议问题