Last active
August 14, 2017 14:28
-
-
Save ollyg/9db70a621d0638b491354e39e5b27bf1 to your computer and use it in GitHub Desktop.
Inspect a github pull request
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
[alias] | |
branchlog = "!git log --oneline --decorate --left-right --graph master..." | |
pr = "!sh -c \"git checkout -b pr/$1 && curl -sL $(git config --get remote.origin.url | sed -e 's|:|/|' -e 's|^git@|https://|' -e 's|\\.git$|/pull/$1.patch|') | git am --whitespace=nowarn\" -" | |
pr-clean = "!git checkout - ; git for-each-ref refs/heads/pr/* --format=\"%(refname)\" | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done" |
When working with PR from a fork, additional steps are required to update the PR.
- First fetch the PR branch:
git fetch git://github.com/USERNAME/netdisco-mibs.git BRANCHNAME
- Then force push back to that branch:
git push git://github.com/USERNAME/netdisco-mibs.git +pr/NN:BRANCHNAME
In the above, NN is the PR number and BRANCHNAME is the PR branch at the repo fork (given under "Command Line Instructions" on the PR page).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use these aliases to help with testing and evaluating Github pull requests.
git pr 14
git pr-clean
git branchlog
This is a little simplistic - it assumes you have a clean HEAD to which the pull request cleanly applies. It assumes you only work on one pull request at a time, and you do it all in one go so you revert to the previous used branch.
Use at your own risk - no warranty, implied or otherwise.