Last Updated: February 25, 2016
·
391
· neduma

How to a break a Git commit?

Recently, i need to break a big private commit to two. So that i can work on one of it and push the other to master.

Here is what i did.

$ git  checkout big-one

$ git checkout -b small-one

$ git checkout --patch master

$ git commit --amend

$ git show

the --patch arguments will go thru each diff against master and ask you you do want to keep it or revert it.

Refer more about it on - Man git-checkout and -- patch option.

[[ Draft ]]