Squashing commits

I tried to squash all my commits by running git rebase -i HEAD~n and got blocked somehow. when i run q to exit, i get stuck. @jwnasambu, please help

Oh sorry about this. Run git log to confirm then number of commits you have then q to exit.

1 Like

You can follow this link https://wiki.openmrs.org/display/docs/Git-Squashing+commits

1 Like


git rebase -i HEAD~4 to see a list of commits, each commit starting with the word “pick”. Then press i you will then see the word -INSERT- at the bottom left navigate the letter writer on the screen to the last “Pick” and replace it with ‘f’ then press Esc you will see a blank space at the bottom and type :x then press enter (I am using --> as pointer don’t type it in, only the commands) then run git push --force

1 Like

There are 4 commits on that branch. so i run git rebase -i HEAD~4. but still somehow blocked

Just follow the above procedure and share the output. Thanks.

What exactly do you mean by blocked?!.. Hope you are keeping this in mind too

Did you guys read this? RFC: Favour not squashing commits over squashing commits

Thanks for the help. Successful

Well, that sounds great but was dwelling on @wyclif comment

@gracebish you can still describe a few steps here that led to your success here to help others

git log -> to know the number of commits git rebase -i HEAD~n Press Esc -> creates a blank line where ther’s INSERT at the bottom then :x
git push --force