Skip to content

Instantly share code, notes, and snippets.

@richsoni
Created July 31, 2013 17:55
Show Gist options
  • Save richsoni/6124408 to your computer and use it in GitHub Desktop.
Save richsoni/6124408 to your computer and use it in GitHub Desktop.
Alias to cherry pick either the last commit on the last branch or the last commit on a given branch
#!/bin/sh
gcherry(){
if [ $1 ];then
name=$1
else
name="@{-1}"
fi
echo "cherry picking $( git reflog $name -n 1 )"
git cherry-pick $( git reflog $name -n 1 | awk '{print $1}' )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment