Yes. What you want to learn is rebase . try
$ git help rebase
another git commit --amend option is git commit --amend . If the commit you are about to commit must be merged with the current HEAD, you can change it.
Both of these options rewrite history. So you need git push -f to git push -f your changes upstream if the affected commits are already at the remote end.
for an example using the simpe rebase example, suppose you make 5 commits,
A
and commit B is a quick fix to commit A,
and commit E is a quick fix for fixing C.
So you want to combine B in and E in C.
$ git rebase -i HEAD~5
you start with this:
pick A msg pick B msg pick C msg pick D msg pick E msg
You rebuild commits so that the merge is lower than those that need to be merged. i.e. B below A (already there) and E below C.
pick A msg pick B msg pick C msg pick E msg pick D msg
and you will tell git not to select a commit, but to crush it; that is, combine it with the above - or fix it - see the man page.
pick A msg squash B msg pick C msg squah E msg pick D msg
everything is done, save the file, and git will reorder and push commits.
so now you have:
A'--C'--D
source share