Skip to content

Instantly share code, notes, and snippets.

@alexwybraniec
Created August 21, 2012 18:21
Show Gist options
  • Save alexwybraniec/3418114 to your computer and use it in GitHub Desktop.
Save alexwybraniec/3418114 to your computer and use it in GitHub Desktop.
gmp (git merge pull/push)
(Assuming you are using bash)
nano ~/.bashrc
Add this line to the bottom of your file...
gmp() { git checkout $2 && git pull origin $2 && git merge $1 && git push origin $2 && git checkout $1; }
Usage:
gmp current_branch target_branch
For example:
gmp dev staging
checks out staging, pulls it to make sure it is up to date, merges in dev, pushes staging back to origin and then returns you to dev.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment