Dienstag, 21. August 2018

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

Keine Kommentare:

Kommentar veröffentlichen

How To Resolve GIT Merge Conflicts with IntelliJ

Resolve a Merge Conflict in GIT with IntelliJ Let us assume you are using Bitbucket or a similar tool to administrate and host your GI...