Last Updated: February 25, 2016
·
1.429K
· bm2yogi

How to keep git merge graph clean

When you have two branches that have diverged. You're done with your feature branch and you want to make the final merge from your feature branch back into your master branch...
Picture
Starting from your feature branch...

git merge develop
git rebase develop
git checkout develop
git merge featureBranch --no-ff
git push

It should now look like this:
Picture

Now, to clean up your feature branch from the remote and locally:
git push --delete origin featureBranch
git branch -D featureBranch

Your merge tree now looks like this:
Picture