关于 Git rebase 的疑问
source link: https://www.v2ex.com/t/808327
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
我需要修改之前一个 commit 的 message,然后我找到了Changing git commit message after push (given that no one pulled from remote) - Stack Overflow的一个回答,我不太理解回答中的以下这段话,请问是什么意思呢?
Note that if you edit your rebase 'plan' yet it doesn't begin the process of letting you rename the files, run:
git rebase --continue
AmoreLee 2 小时 4 分钟前
执行 git rebase -i HEAD~4
会出现一个页面,让你标记每个 commit 的顺序,是否需要修改信息等。也就是所谓的 ‘plan’,告诉 git 你想对这些提交干啥。
如果你设置好你的 ‘plan’, 但是 rebase 没开始,就执行 git rebase --continue 告诉 git 开始 rebase 就好了。
不过需要注意的是,一旦 rebase 就会改动你的提交记录,如果之前已经提交到远程,rebase 后再想 push 是会报错的。除非你强制推送,但如果别人已经拉取过你的远程仓库,那就会造成很多麻烦。如果只是本地仓库就无所谓了。
dangyuluo 1 小时 55 分钟前
```
git rebase -i C~1 # or git rebase -iB
```
然后修改 rebase 命令,把 C 那行的第一个动词改成 e,然后保存。这时候你就到了 C 提交之后的那一刻,修改好之后(我一般`git commit --amend`),再`git rebase --continue`,之后的 DEF 等 commit 就会自动回来,有冲突的话会停在冲突的地方。
rebase 还支持其他命令,自己玩玩就行
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK