Skip to content

Instantly share code, notes, and snippets.

@Narretz
Created May 23, 2016 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Narretz/2a7283c34ce24f8358e2f1a6fa2a22e2 to your computer and use it in GitHub Desktop.
Save Narretz/2a7283c34ce24f8358e2f1a6fa2a22e2 to your computer and use it in GitHub Desktop.
Bash script that extracts commits from Github PR and puts them on top of the current branch
#!/bin/bash
set -e
prurl=${1:?"Pull request URL is mandatory"}
prno=${prurl##*/}
curl -kL "$prurl.patch" | git am -3 && git commit --amend -m "$(git show --format=%B HEAD -s)
Closes #${prno}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment