[英]How to do git squash commits with given commit messages
I have several "save point" commits and would like to squash them to have a more readable timeline. 我有几个“保存点”提交,并希望压缩它们以获得更可读的时间轴。 Here is my situation:
这是我的情况:
> git log
29a94be3d2d4f Added some feature
9bf0f2730234e savepoint << Pushed here
240e1ce8893e9 Add ignore rule
01462e889d416 savepoint
6238e3b775027 Fixed Something << Pushed here
0d485486a42a9 Update Version
......
06ad9e4fc5f64 savepoint
1462e57657434 Initial Commit
And I would like to have 而且我想拥有
29a94be3d2d4f Added some feature
240e1ce8893e9 Add ignore rule
6238e3b775027 Fixed Something
0d485486a42a9 Update Version
1462e57657434 Initial Commit
Is there a way to script this, so I can say: 有没有办法编写脚本,所以我可以说:
git squash -commits-with-log="savepoint" ~FROM_INITIAL_COMMIT
更新:似乎诀窍在于GIT_SEQUENCE_EDITOR
变量
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.