【问题标题】:What can cause git commit to disappear?什么会导致 git commit 消失?
【发布时间】:2016-02-23 07:12:42
【问题描述】:

使用 git,我知道变基会重新创建正在变基的提交,从而为每个提交创建全新的 sha 值。

变基是破坏现有sha 值的唯一方法吗?

【问题讨论】:

    标签: git rebase sha


    【解决方案1】:

    还有很多方法可以做到这一点,这里也没有描述。

    • checkout / revert /reflog / reset
      在这里阅读全部内容:How to move HEAD back to a previous location? (Detached head)

    • git filter-branch
      此命令会更改您的历史记录并允许您删除提交。

    • git rebase / git rebase -i HEAD~x
      在这里你可以将多个提交压缩成一个新的提交

    • BFG Repo-Cleaner 像 git-filter-branch 一样删除大的或麻烦的 blob,但速度更快。

    BFG Repo-Cleaner

    【讨论】:

      猜你喜欢
      • 2020-03-22
      • 1970-01-01
      • 2014-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-15
      • 2020-12-12
      相关资源
      最近更新 更多