15

如何对commit进行重排序?

 3 years ago
source link: https://www.maixj.net/ict/commit-paixu-24270
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.
neoserver,ios ssh client

如何对commit进行重排序?

2021年1月1日 / 1次阅读Git

使用 git rebase 命令,可以实现对 commit 历史的修改,包括重排序!

如何做呢?

git rebase -i <start_commit_id>

此时会弹出一个编辑界面,显示从start_commit_id开始(但不包括它)的所有commit,

手动调整pick commit_id的排列顺序,保存退出。

这样就完成了commit重排序,因为 git rebase 命令中的pick子命令,表示选择某个commit,调整pick的顺序,就是调整对应commit的顺序。

git rebase -i命令的这个界面,除了重排序commit,还可以合并,删除commit等操作,相当灵活。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK