Andre Schütz - Learn. Think. Reflect - Tech developer
Replace commit messages within rebase process to squash entries by using vim

Replace commit messages within rebase process to squash entries by using vim

If you have a GIT project and want to make a rebase and squash from your feature branch against the master branch, you can simplify the adaptation of the pick entries to s (squash) by the following commands from within vim.

# We are on the "feature" branch and the "master" branch was `fetched` and `merged` before
> git rebase -i master

# We want to change the "pick" entries to "s" within "vim"
# c .. means "confirm"
:s/^pick/s/c

# We press "n" for the first entry of the commit messages list
# Then we press "a" to confirm that all other entries should be changed

Leave a Reply