Squash GIT commits

//checkout from a remote branch to a local branch A
$ git branch
branch A (highlited)
$ git checkout -b B
branch B (highlited)
//do multiple commits to preserve the steps and protect everything with version control
$ git commit -am "[BPA-...] ..."
$ git commit -am "[BPA-...] interim, not compiling"
$ git commit -am "[BPA-...] reverting the change and doing something other"
//done? then checkout to local branch A again and merge, squash the commits
$ git checkout A
$ git merge --squash B
// all commits are gathered into one.
//finally, push to the remote. One commit, nice and clean
$ git push origin/A A


Beliebte Posts