Snippets

Ahmad Ajmi git-rebase-example.txt

Created by Ahmad Ajmi last modified

I have two commits I need to squash into one commit, for example after I run git log I get this view:

screen shot 2016-05-09 at 8 42 57 am

Next I did git rebase -i HEAD~2 and get this result:

screen shot 2016-05-09 at 8 46 37 am

The next step while I'm in this screen is to use s command to squash from the second commit line, and after editing, the previous shot will be:

screen shot 2016-05-09 at 8 49 15 am

using Vim, I can save and quit :wq.

Another window will open like:

screen shot 2016-05-09 at 8 50 42 am

this will contain all the commit messages for all the previous two commits, I can update them as I need. After editing, this will be the result

screen shot 2016-05-09 at 8 57 29 am

using Vim, I can now save and quit :wq and I'm done

This is a straight process without any conflicts or anything in between that might happen sometimes

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.