如何使用给定的提交消息进行git squash提交

时间:2016-06-11 08:09:28

标签: git

我有几个“保存点”提交,并希望将它们压缩以具有更易读的时间轴。这是我的情况:

> 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

我想要

29a94be3d2d4f Added some feature
240e1ce8893e9 Add ignore rule
6238e3b775027 Fixed Something
0d485486a42a9 Update Version
1462e57657434 Initial Commit

有没有办法编写脚本,所以我可以说:

git squash -commits-with-log="savepoint" ~FROM_INITIAL_COMMIT

1 个答案:

答案 0 :(得分:0)

更新:似乎诀窍在于GIT_SEQUENCE_EDITOR变量