Reduce git branch into 1 commit

Posted . Visible to the public.

Make sure to rebase from master (or parent branch):

git rebase origin/master

Say your current local branch has 4 commits. To squash into 1 commit, do the following:

git rebase -i HEAD~4

Brings up editor that will allow you to p (pick) and f (fixup -- like squash) the commits you want. Save your commit text.

If you want to merge to master:

git checkout master
git merge name-of-branch
git push

If you want to delete the branch:

git branch -D name-of-branch
hashharvest
Last edit
hashharvest
Posted by hashharvest to hashharvest's deck (2017-12-13 06:16)