Last active
December 16, 2019 17:19
-
-
Save thegeorgeous/9356030fc42a76a1096f6c279e8a325e to your computer and use it in GitHub Desktop.
Cherry pick zsh script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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