Git: Discard all changes on a diverged local branch

后端 未结 2 1339
无人共我
无人共我 2021-01-29 20:03

I have a local topic branch that\'s tracking a remote branch. For the sake of argument, say the commit histories look like this:

A--B--C--O1--O2--O3 (origin/phob         


        
2条回答
  •  青春惊慌失措
    2021-01-29 20:33

    git checkout phobos
    git reset --hard origin/phobos
    

    This tells Git to reset the head of phobos to the same commit as origin/phobos, and to update the working tree to match.

提交回复
热议问题