Answers:
我不知道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之间的区别在于,在重新设置基准期间,该squash
操作将提示您合并原始消息和squash提交的消息,而该fixup
操作将保留原始消息,并从fixup提交中丢弃该消息。
简而言之,在对一系列提交进行基础调整时,每个标记为的提交都会squash
使您有机会将其消息用作a pick
或reword
commit消息的一部分。
当您使用fixup
该消息时,该提交将被丢弃。
fixup
然后保留哪个消息?
如果要将两个或多个提交折叠成一个,请用“ squash”或“ fixup”替换第二个及后续提交的命令“ pick”。如果提交的作者不同,则折叠的提交将归因于第一个提交的作者。对于折叠提交,建议的提交消息是第一次提交的提交消息和使用“ squash”命令的提交消息的串联,但是使用“ fixup”命令省略了提交的提交消息。
如果问题是在进行git rebase --interactive时gitsquash
和fixup
git 有什么区别,那么答案就是提交消息。
s, squash <commit>
=使用提交,但可以合并到先前的提交中
f, fixup <commit>
=类似于“ squash”,但丢弃此提交的日志消息
例如:
pick 22a4667 father commit message
squash 46d7c0d child commit message # case 1
# fixup 46d7c0d child commit message # case 2
在情况1中重新定位后的提交消息为:
father commit message
child commit message
而情况2的提交消息是:
father commit message
# no sub messages
为什么不问git本身呢?使用进行基准调整时git-bash
,它会显示:
pick 512b1d7 (some comment)
# Rebase 621b2e4..512b1d7 onto 621b2e4 (1 command)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
D:/code/fenixito-legacy-api/.git/rebase-merge/git-rebase-todo [unix] (11:57 23/10/2019) 1,1 start
"D:/code/xxx/.git/rebase-merge/git-rebase-todo" [UNIX] 27L, 1170C
所以你看:
s,squash =使用提交,但可以合并到先前的提交中
f,fixup =类似于“ squash”,但丢弃此提交的日志消息
rebase
在Git docs上阅读有关壁球和固定的更多信息。