Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@DanKaplanSES
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanKaplanSES/78d1680eaba4fb08bc90 to your computer and use it in GitHub Desktop.
Save DanKaplanSES/78d1680eaba4fb08bc90 to your computer and use it in GitHub Desktop.
My Git Merge command
#!/bin/bash -x
set -e
#by naming this git-m and putting it in your PATH, git will be able to run it when you type "git m ..."
if [ "$#" -ne 2 ]
then
echo "Wrong number of arguments. Should be 2, was $#";
exit 1;
fi
git show-branch $2 || (echo "$2 is not an exiting branch" && exit 1);
git checkout $1;
git merge --ff-only $2;
git branch -d $2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment