Skip to content

Instantly share code, notes, and snippets.

@ollyg
Last active August 14, 2017 14:28
Show Gist options
  • Save ollyg/9db70a621d0638b491354e39e5b27bf1 to your computer and use it in GitHub Desktop.
Save ollyg/9db70a621d0638b491354e39e5b27bf1 to your computer and use it in GitHub Desktop.
Inspect a github pull request
[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"
@ollyg
Copy link
Author

ollyg commented Aug 14, 2017

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