简体   繁体   中英

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变量

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM