GitHub pull requests

For this section, you will be looking specifically at the GitHub model of pull requests. Not all pull requests and relationships between repositories are managed in exactly the same way among different Git servers.

The standard GitHub model is to:

  • Fork the repository
  • Make a branch on the forked repository
  • Make changes on this branch
  • Make a pull request to the original repository to merge this branch’s changes

Your task now is to do this on the GitHub repository!

There is a file called records/trained_users.txt in this repository. You’re going to add your name to it and raise that change as a pull request.

Remember that this is just one model of pull request! This lesson won’t cover details on the others, but just be aware that they can differ so you are not surprised in the future.

If you haven’t created a GitHub account, please do so now. It’s free. Go to https://github.com and follow the instructions to sign up.

Fork the repository

Next, you need to fork the repository. To do this, go to the learngitthehardway repository on GitHub: https://github.com/ianmiell/learngitthehardway

Click on the Fork button near the top.

You will now have created a fork of the repository in your own account. Replace YOURUSERNAME with your username in the below URL and you should see the same repository homepage: https://github.com/YOURUSERNAME/learngitthehardway

Branch on the forked repository

To make a branch on your forked repository, type in these commands:

1	git clone https://github.com/YOURUSERNAME/learngitthehardway
2	cd learngitthehardway
3	git checkout -b myfirstbranch
4	git status

You just cloned your forked version of the repository and created a branch called myfirstbranch. As ever, running git status gives you a quick view of which branch you’re on.

Get hands-on with 1200+ tech skills courses.