Last active
April 11, 2021 12:26
-
-
Save jhass/48c6ec1aa732d7287432 to your computer and use it in GitHub Desktop.
Little helper to merge pull requests to the stable for diaspora/diaspora. Handy alias: git config alias.mds merge-diaspora-stable
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 | |
set -e | |
if [ -z "$1" ]; then | |
echo "No PR given" | |
exit 1 | |
fi | |
parts=(${1//\// }) | |
pr=${parts[${#parts[@]}-1]} | |
git checkout next-minor | |
git pull origin next-minor | |
curl -L "$1.patch" | git am -3 | |
$EDITOR Changelog.md | |
git commit --edit --amend -F <(echo -ne "$(git log -1 --format=format:%B)\n\ncloses #$pr") -- Changelog.md | |
git checkout develop | |
git pull origin develop | |
git merge next-minor | |
commits=$(git log --format=format:%H origin/next-minor...next-minor | xargs echo) | |
read -n1 -p "Push? (Y/n) " push | |
if [ -z "$push" -o "$push" = "y" -o "$push" = "Y" ]; then | |
git push origin next-minor develop | |
fi | |
echo "Merged as $commits" | tee >(type xclip &>/dev/null && xclip -selection clipboard) >(type pbcopy &>/dev/null && pbcopy) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment