CARVIEW |
Guides: Pull Requests
Pull requests are a way to poke someone and let them know you’ve got some code they may want.
They work great when you want to let an upstream maintainer know that you’ve pushed some useful changes to your fork of their project.
They also work great if you want to let a fellow developer know that you’ve pushed some experimental features to an arbitrary branch.
Step One
First, navigate to your project with the changes you want someone else to pull. In this instance, I’m going to go to defunkt/grit and tell mojombo to pull a change.
Step Two
I can type in a message if I want and select any number of recipients. By default, I’ll see everyone who has a project in my project’s network. If I want to add someone else, I can use the autocompleter and click ‘add.’
Step Three
Sent!
Step Four
When mojombo logs in, he’ll see that there’s a new message waiting for him.
Step Five
mojombo can reply to my message, delete it, or ignore it. Pulling from me is easy. mojombo can add the defunkt repository as a remote source and fetch its contents like this:
$ git remote add defunkt git://github.com/defunkt/grit.git $ git fetch defunkt
The ‘git remote add’ will stay in your repository configuration, so the next time you get a pull request, you only need to fetch again. Note that to fetch from a private repository, you need to use the private update URL. If grit were private for example, the remote add would look like, “git@github.com:defunkt/grit.git”.
To merge the changes done in the defunkt repository to a local branch, e.g., the master branch, you can run
$ git checkout master $ git merge defunkt/master
You can also use the git-pull helper to do the fetch+merge in one step. This comes in handy for one-shot pulls where you do not want to use the same repository again in the near future:
$ git checkout master $ git pull git://github.com/defunkt/grit.git master
Now that you have merged defunkt/grit’s master branch, you should probably push your branch to let others see the merge.