Git 有办法丢弃某些 commit 么?

lawrence · November 10, 2014 · Last by JIAZHEN replied at November 10, 2014 · 2161 hits

那些 commit 只是为了临时保存记录,commit info 里没啥东西,删除了节省空间,看着也省事:)

Squash 这些 commits. git rebase -i HEAD~2 # squash the last 2 commits

Git interactive rabase

#1 楼 @JIAZHEN 我的需求貌似比这个呀复杂,如果删除所有 commit info 小于 5 个字节的提交呢?

#2 楼 @lawrence Ahhh, 不好意思,没看仔细以为你只想修改 commit history The Solution in Stack Overflow

#3 楼 @JIAZHEN 类似的,不知道 squash 可否合并 commit message 字节小于 5 的所有 commit,呵呵

#4 楼 @lawrence 看到上面的链接了吗?应该可以解决你的问题。

  • 导出 git commit history
  • 在文本 editor 中修改
  • 导入
  • Done
You need to Sign in before reply, if you don't have an account, please Sign up first.