Skip to content

Instantly share code, notes, and snippets.

@jhass
Last active April 11, 2021 12:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhass/48c6ec1aa732d7287432 to your computer and use it in GitHub Desktop.
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
#!/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