Skip to content

Instantly share code, notes, and snippets.

@mamut
Last active December 21, 2015 17:58
Show Gist options
  • Save mamut/6343660 to your computer and use it in GitHub Desktop.
Save mamut/6343660 to your computer and use it in GitHub Desktop.
`./git-patchmaker.sh 123456` will `git cherry-pick` all commits from master related to pivotal ticket #123456 to a stage branch
#!/bin/bash
set -e
pivotal_ticket_id=$1
function commits_from_master() {
git checkout master > /dev/null 2>&1
git log --reverse --oneline --no-abbrev-commit --grep $1 | cut -d ' ' -f 1
}
function apply_on_stage() {
git checkout stage > /dev/null 2>&1
git cherry-pick $@
}
commits=$(commits_from_master $pivotal_ticket_id)
apply_on_stage $commits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment