rebase branch to master recovery

This question already has an answer here:

  • Undoing a git rebase 14 answers

  • 如果你的远程回购还行,只是

    git checkout anybranch
    git branch -D master
    git fetch --all
    git checkout master
    

    When you make mistakes with the branches and where they point, you can get rescued by git reflog .

    git reflog
    

    will show you where the branch was pointing to before. So if your rebase is wrong, you can "undo" it by pointing the branch to where it used to be with:

    git reset --hard HEAD@{1}
    

    Change 1 to be another number depending where the commit that you want is in the list that reflog provides.

    The reflog is also useful for many other mistakes one can make.

    链接地址: http://www.djcxy.com/p/23532.html

    上一篇: 如何“撤销”rebasing提交

    下一篇: rebase分支掌握恢复