美文网首页
git rebase 后代码不见了, 找回消失的commit

git rebase 后代码不见了, 找回消失的commit

作者: CarinaXiaoWang | 来源:发表于2020-08-11 13:41 被阅读0次

    git rebase 后代码不见了, 找回消失的commit

    1. 使用git log看不到

    2. 使用git reflog
      例如:
      cd191e4 HEAD@{3}: rebase -i (finish): returning to refs/heads/feature-live1
      cd191e4 HEAD@{4}: rebase -i (pick): Merge made by the 'recursive' strategy.
      8322d99 HEAD@{5}: commit (amend): add live model

    3. git checkout -b branch-bak [commit-sha]
      git checkout -b branch-bak 8322d99

    bravo 找回来了🎉

    参考 https://blog.csdn.net/whereismatrix/article/details/50611706

    git reflog https://git-scm.com/docs/git-reflog
    Git内部维护和数据恢复Git-Internals-Maintenance-and-Data-Recovery
    https://git-scm.com/book/zh/v2/Git-%E5%86%85%E9%83%A8%E5%8E%9F%E7%90%86-%E7%BB%B4%E6%8A%A4%E4%B8%8E%E6%95%B0%E6%8D%AE%E6%81%A2%E5%A4%8D

    相关文章

      网友评论

          本文标题:git rebase 后代码不见了, 找回消失的commit

          本文链接:https://www.haomeiwen.com/subject/hxzedktx.html