git command for making one branch like another

前端 未结 9 1280
半阙折子戏
半阙折子戏 2020-11-22 11:36

I\'m trying to take a branch with changes and bring it back to be identical to the upstream it diverged from. The changes are both local and have been pushed to github, so n

9条回答
  •  孤独总比滥情好
    2020-11-22 11:56

    Heavy handed, but hell, what can possibly go wrong?

    • Check out the branch X you want to look like the Y
    • cp -r .git /tmp
    • Check out branch Y git checkout y
    • rm -rf .git && cp -r /tmp/.git .
    • Commit & push any difference
    • DONE.

提交回复
热议问题