[英]Git rebase interactive - how to rebase only this branch commits?
我有一个本地分支让我们称之为DEV。 分支提交历史记录如下:
module_A:添加CRC验证(9273467932)
module_B:更改关机程序(84705723)
合并拉出请求#918来自XXX(265424)
module_D:cleanup(3859236)
合并分支fix_for_drain_issue(38572693)
(......)
现在,我不喜欢第四个提交消息“清理”它是模糊的所以我想编辑它。 所以我去:
git rebase -i 3859236
vim打开,我将3859236标记为编辑 。 接下来我做git commit --ammend
修改并将提交消息更改为更具描述性的。 到现在为止还挺好。 因为这是我想要做的唯一改变,我终于发出了git rebase --continue
而且这里有惊喜:
interactive rebase in progress: (...) both modified: tools/src/file.c
怎么可能? 我所做的只是更改提交消息对吗? 那么世界git如何引发冲突的文件呢? 我的理论是git试图从我所拥有的合并提交中重新提交所有提交,这可能会导致冲突。 特别是如果在此期间我拉了这些分支。
我已经尝试了所有已经-p来保存提交消息; -r重新创建合并提交 - 没有成功,它总是试图改变这些分支。 当rebase edit-todo列表出现时我也看到了它。 它列出了不在我当前分支上但在我合并或樱桃选择的这些分支上的提交。
所以我的问题归结为这个 - 我如何限制rebase只重新组织来自这个特定分支的提交。 或者如何编辑,有时在这个分支中压缩提交而不进行变基。
您不想编辑修订版....您想要重新编写它。
# 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
# b, break = stop here (continue rebase later with 'git rebase --continue')
# 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.
你最终得到了这样的信息,因为你背后的反叛者。 如果你想使用编辑,当修改停止时,你将你的更改添加到索引,然后你运行git rebase --continue ,你不能自己提交...如果你选择使用reword ,一次您在编辑器中保存文件的内容,当您退出时,rebase将自动继续,无需要求它继续。
尝试相同的过程,但使用rebase -i
使用您想要编辑的提交之前的提交。
这将在现有提交(之前的提交)之上重放您的编辑
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.