Simple script for git
, to locally pull a PR from Github, with an option to not commit changes
Add this to your git config (eg ~/.gitconfig
)
[alias]
pr = "!php /full/path/to/ozh_git_pr.php"
Assuming you want to locally test PR #1337, just do:
git pr 1337
# or
git pr -n 1337
In detail, this:
- creates a new branch named
pr-1337
and switch to it - pulls whatever repo/branch has been submitted as the PR on Github
- with the
-n
option, does not commit changes, so you still see what files are modified and what's changed in them
This will be equivalent to :
git checkout -b pr-1337
git pull [--no-commit] https://github.com/SOMEDUDE/SOMEFORK.git SOMEBRANCH
With a gigantic pull request that changes a lot of files, it can be easier to review changes, since modified files are marked (if using a tool with icon overlays, like TortoiseGit)
From now on you can review, of course modify, and then commit changes, or simply git merge --abort
if proposed changes are not suitable.
Do whatever the hell you want to do with it