Skip to content

Instantly share code, notes, and snippets.

@thegeorgeous
Last active December 16, 2019 17:19
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 thegeorgeous/9356030fc42a76a1096f6c279e8a325e to your computer and use it in GitHub Desktop.
Save thegeorgeous/9356030fc42a76a1096f6c279e8a325e to your computer and use it in GitHub Desktop.
Cherry pick zsh script
# Usage
# $ cherry-pick 1898
# This will pick up all commits with 1898 in the commit message
# Can be used to cherry pick commits related to a ticket when creating
# a release branch
cherry-pick() {
mkdir -p tmp;
git log master --grep=$1 --pretty=%h --no-merges > tmp/cherry-pick.txt;
output=$(cat tmp/cherry-pick.txt | sed 's/:.*//');
for string in $output
do
git cherry-pick $(echo $string) --strategy=recursive -X theirs;
done
rm tmp/cherry-pick.txt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment