Last Updated: February 25, 2016
·
521
· nigro

git alias for: rebasing, merging and cleaning

Add below alias to your .git/config file
[alias] ff = !sh -c 'CURRENT_BRANCH=\`git rev-parse --abbrev-ref HEAD\` && git rebase $1 && git checkout $1 && git merge $CURRENT_BRANCH && git branch -D $CURRENT_BRANCH && git push origin :$CURRENT_BRANCH' -
now when you are working on feature branch and you would like to merge it with master branch you can do:

git ff master

This one command will do for you:
git rebase master git checkout master git merge <featurebranch> git branch -D <featurebranch> git push origin :<featurebranch>