git - Git/Git 扩展中的 "squash"和 "fixup"有什么区别?

标签 git git-extensions squash fixup difference

我使用 Git Extensions 已经有一段时间了(太棒了!)但我还没有找到以下问题的简单答案:

有时,在输入提交消息时,会出现打字错误。我的 friend 向我展示了如何通过以下方式修复它(在 Git Extentions 中):

Right-Click on the commit > Advanced > Fixup commit

enter image description here

然后我只需选中“修改”框并重写我的消息,瞧!我的提交消息已修复。

但是这个其他选项“Squash commit”...我一直想知道它的作用是什么?!

我的问题是:

有人能简单地解释一下 Git/Git ExtensionsSquash commitFixup commit 之间的确切区别是什么吗?它们对我来说有点……“相似”: enter image description here enter image description here

最佳答案

我不知道 Git Extensions 具体用它做了什么,但是 git rebase 有一个选项可以自动压缩或使用压缩修复提交!或修复!前缀,分别为:

   --autosquash, --no-autosquash
       When the commit log message begins with "squash! ..." (or "fixup!
       ..."), and there is a commit whose title begins with the same ...,
       automatically modify the todo list of rebase -i so that the commit
       marked for squashing comes right after the commit to be modified,
       and change the action of the moved commit from pick to squash (or
       fixup).

squash 和 fixup 之间的区别在于,在 rebase 期间,squash 操作会提示您 merge 原始消息和 squash 提交的消息,而 fixup操作将保留原始消息并丢弃来自修复提交的消息。

关于git - Git/Git 扩展中的 "squash"和 "fixup"有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16758131/

相关文章:

git - 如何使用 tortoisegit 在 git 中创建用户?

git - 如何使用 git remote 分配本地文件?

git - 大量git历史记录重写后如何同步本地历史记录?

git - Git Extensions 中的期刊后台 'git status' 干扰交互工作

git - 将 git-push 复制到另一台计算机,或执行较小的增量推送?

merge 后的 Git squash 历史记录

git - merge --squash 和 rebase 有什么区别?

git - 使用 git send-email 回复邮件列表中的同一线程

git - 无法在笔记本电脑上克隆 git 存储库,但是在开发机器上成功克隆

java - 在 Webdriver selenium 上激活 javascript