Skip to content

Commit

Permalink
Downloading a PR and Reviewing it. (Path-Check#82)
Browse files Browse the repository at this point in the history
Added info on how to download a PR from a Forked Repo in order to review it.
  • Loading branch information
vitorpamplona authored and SamMakesThings committed Mar 22, 2020
1 parent af53268 commit db138c3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,34 @@ code releases.
* A team member will review the pull request, request change or approve and
merge into the `develop` branch.
## Reviewing Pull Requests
* Open the PR on Github. At the top of the PR page is a number which identifies it -123 and the name of the author's branch -branch-name. Copy down both of these.
* Open git bash and ensure your working directory is clean by running ```git status```
* Get a copy of the PR by typing ```git fetch upstream pull/<id>/head:<new local branch>```. In this example you would type git fetch upstream pull/123/head:branch-name
* Now that you have a copy of the branch, switch to it using ```git checkout branch-name```. Your directory will now be an exact copy of the PR. Be sure to tell the author about any bugs or suggestions, as you cannot add your own changes to a pull request directly.
* When you are done checking out their work, use ```git checkout master``` to return to your local version
### Git Aliases to help with pull request reviews
Aliases are shortcuts that you can define in git bash (or linux/mac) that reduces typing and minimizes errors. The following commands create two aliases, one for grabbing a PR and switching to that branch. The other one deletes the branch.
Copy/paste each line (one at a time) to gitbash or terminal window.
```git config --global --add alias.pr '!f() { git fetch -fu ${2:-upstream} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f'```
and
```git config --global --add alias.pr-clean '!git checkout master ; git for-each-ref refs/heads/pr/* --format="%(refname)" | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done'```
Once created the aliases are used as shown below.
* To pull a pull request: ```git pr <id>``` to use the example above git pr 123
* To delete all the pull requests created locally: ```git pr-clean```
# Additional Resources
* [General GitHub documentation](http://help.github.com/)
Expand Down

0 comments on commit db138c3

Please sign in to comment.