[英]How to fixup commits to upper in Git?
在 Git 中变基时,我们通常可以加入(修复、挤压)几个提交到底部一个,例如, A, B, C -> A'
(这里 B 和 Z0D61F8370CAD114D412F80B84D 比 A.15F80B84D 更新) 这不是一个好的做法,因为您会看到工作开始的日期(提交 A),但不是完成日期(提交 C)。 就像您在 23.09.2019 上制作了一个功能,但不是在 25.09 上。
现在我们有几个提交并且想要修复 A、B、C 到 C: A, B, C, D, E -> C', D', E'
这个怎么做?
我会这样进行
# We first point to C
git checkout C
# Then we "unpack" changes between A and C into the working tree
git reset --soft A
# Let's now create commit C'
git commit -m "Message for C' (so A,B and C)"
# and finally we just have to bring back copies of D and E
git cherry-pick D E
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.