Last active
December 12, 2015 09:29
-
-
Save passcod/4752466 to your computer and use it in GitHub Desktop.
Script to automate merging PRs on [homebrew-cask](https://github.com/phinze/homebrew-cask)
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
#!/bin/bash | |
if [[ -z "$1" ]]; then | |
echo " => Usage: $0 user:branch" | |
exit 64 | |
fi | |
user=$(cut -d ":" -f1 <(echo "$1")) | |
repo="homebrew-cask" | |
branch=$(cut -d ":" -f2 <(echo "$1")) | |
if ls | grep -q brew-cask.rb; then | |
echo -n " => Switch to master… " | |
if git checkout master; then | |
echo "OK" | |
else | |
echo " => Git error" | |
exit 69 | |
fi | |
else | |
echo " => We’re not at root of $repo" | |
exit 64 | |
fi | |
echo " => Fetch $1" | |
git fetch "git://github.com/$user/$repo" "$branch" | |
sha=$(git rev-parse --verify FETCH_HEAD) | |
echo " => SHA: $sha" | |
echo " => Cherry-pick commit to master" | |
git cherry-pick "$sha" | |
echo "git commit --amend --signoff" | pbcopy | |
echo " => You can now look around and finish the merge" | |
echo " => Use: git commit --amend --signoff (just ⌘ + V)" | |
echo " => " | |
echo " => Format for commit message is usually:" | |
echo " => " | |
echo " => Software Name 1.2.3" | |
echo " => " | |
echo " => Closes #123." | |
echo " => " | |
echo " => Signed-off by: John Doe <[email protected]>" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment