有没有一种方法可以在执行合并操作时自动添加所有来自压缩的
mybranch
提交中的提交注释?git merge --squash mybranch
为了使单个提交包含来自mybranch
的所有提交注释的连接
git clone http://vm.bit-booster.com/bitbucket/scm/bb/rebase-example-2.git
cd rebase-example-2
git checkout branch
git reset --hard origin/master
git merge --squash origin/branch
git commit --no-edit
git show
commit 74656c51212526af49382c985419244737141217
Author: G. Sylvie Davies <sylvie@bit-booster.com>
Date: Mon Dec 26 22:07:50 2016 -0800
Squashed commit of the following:
commit 3120cbba4e94e0a81eed2f9ff42e7012cca996bf
Author: G. Sylvie Davies <sylvie@bit-booster.com>
Date: Thu Dec 15 18:24:02 2016 -0800
b2
commit ccb522334464879b8f39824031c997b57303475d
Merge: 6b85efb 026bf0c
Author: G. Sylvie Davies <sylvie@bit-booster.com>
Date: Thu Dec 15 18:13:35 2016 -0800
m
commit 6b85efbddbb74d49a096bfc54fd4df15e261b72f
Author: G. Sylvie Davies <sylvie@bit-booster.com>
Date: Thu Dec 15 18:12:51 2016 -0800
b1
git merge --squash
,但在 Git 2.10.1 中进行了测试,发现它的工作方式与之前相同。 - torek