`git rebase -i master` then press keyboard 'i' to edit you will see like this: pick etc1 pick etc2 pick etc2 replace the word pick with `'f'` and press `esc y :wq` pick etc1 //this commit will the one commit f etc2 f etc2 and press this command git push origin +head