[GitHub] LEVEL 2 Single Repository Workflows
2.2 Pull Requests Within a Repository
We're going to "come to you" and collaborate on your fork of the "dojo_rules" repository. To start out, we'll try doing some work on a local branch with a pull request.
1. Add a collaborators. "Settings --> Collaborators"
2. Create a branch of the "dojo_rules" repository locally and name it "deadly_skills". Push it up to GitHub. At this point, the branch will have the same content as the master branch.
$git branch -b deadly_skills
[deadly_skills] $git push origin deadly_skills
3. On your "deadly_skills" branch, open up your introduction file and modify it to include a list of your deadly skills (for example: Git, JavaScript, Ruby). Since this file is Markdown, you can specify these one per line starting the line with a *
to make them into a list.
Add, commit and push your changes up to GitHub. Be sure to push to the remote branch with the same name as your local branch – deadly_skills
.
dojo_rules$ git commit -am "Added deadly skills" dojo_rules (deadly_skills)$ git push origin deadly_skills
4. Create a pull request from your branch to your master. When you create a pull request by default it'll go from your master branch back to "deadlyvipers/dojo_rules". In this case though, we want the pull request to go from "dojo_rules/deadly_skills" to "dojo_rules/master" – both in your repository.
To do this, create a pull request and click "Edit" at the top. Make sure the base is your master and the "compare" is your "deadly_skills" branch. This should show all of the changes you made on your branch.
3 Merge the pull request.
Closing Pull Requests by Merging
Start by getting all changes on GitHub on your master branch: dojo_rules (deadly_skills)$ git checkout master dojo_rules (master)$ git pull Next, merge in the using the no-ff option. dojo_rules (master)$ git merge --no-ff deadly_skills -m "Merging in deadly_skills" Force push it to GitHub: dojo_rules (deadly_skills)$ git push
git checkout master git pull git merge --no-ff deadly_skills git push