rebase分支掌握恢复

这个问题在这里已经有了答案:

  • 撤消git rebase 14个答案

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

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

    当你在分支上犯错时,你可以通过git reflog获得救援。

    git reflog
    

    会告诉你分支指向的地方。 所以如果你的rebase是错误的,你可以通过将分支指向原来的位置来“撤销”它:

    git reset --hard HEAD@{1}
    

    将1更改为另一个数字,具体取决于您希望提交的位置在reflog提供的列表中。

    reflog对于人们可以犯的许多其他错误也很有用。

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

    上一篇: rebase branch to master recovery

    下一篇: Did i just destroy my work by incorrectly using git rebase