Created
July 2, 2013 08:16
-
-
Save nise-nabe/5907582 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
# 第一引き数に チケット番号を与えると t-(チケット番号)に一致するブランチから | |
# (refs #(ブランチ名)) を持つコミットを取ってきてカレントブランチにマージする | |
TICKET_ID=$1 | |
BRANCH=t-${TICKET_ID} | |
MERGE_TARGET=${BRANCH}-target | |
current_branch=`git branch | grep "*" | sed -e 's/^* \(.*\)/\1/g'` | |
git checkout -b ${MERGE_TARGET} | |
git log --grep="(refs #${TICKET_ID})" ${BRANCH} --format="%H" | git cherry-pick --stdin | |
git checkout ${current_branch} | |
git merge --no-ff ${MERGE_TARGET} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment