zigford.org/trying-out-a-pull-request.md
2020-07-21 06:49:32 +10:00

60 lines
1.8 KiB
Markdown

Trying out a pull request
You've received a pull request on your repo. Before merging you want to see what
it looks like in your code base. Perhaps you will run some manual test or some
diffs from the command line here and there.
---
You can find this information anywhere out there on the web. As always the
purpose of this blog is more of a notetaking for me, but the other angle I want
to cover is not the exact commands to type (That will be here too), but why you
are typing them.
Get setup
---------
You want to start off with a clean local repository. That might mean running a
`git pull`, a `git clone` or switching to the master branch using `git
checkout`.
I'm checking out a PR for my [snapd ebuild
repo](https://github.com/zigford/snapd)
What information will you need?
-------------------------------
You will need to know the GitHub authors account name and the branch that they
are making changes from.
The commands
------------
From here it's easy. Conceptually, we are _checking out_ a local branch to
_pull_ the changes into
# localbranchname is a new branch where we will pull
# the PR. It can be named whatever
# master is the branch we want the new branch to be
# based off
git checkout -b <localbranchname> master
git pull <githubAddressToUsersFork>.git <branchTheyCommitedTo>
Merge to master
---------------
Perhaps your happy with the change. Your very close to being able to merge the
PR to your master repo. Here is how you would do that.
1. _checkout_ your master branch
2. _merge_ the local branch you created earlier
3. _push_ changes back up to the remote _origin_
git checkout master
git merge <localbranchname>
git push origin master
Tags: git, github