Practice using git to contribute to GitHub projects (without fear of messing something up :) )
How to use this repo (based on this article)
-
Get git: This article assumes you already know the steps to take to contribute to open source. If you don’t know, you may want to read this article written by Maryna. This piece also assumes that you’ve already setup Git on your PC. If you haven’t, you may want to check the setting up Git section of this article and do that first.
-
Clone the project to your local machine:This is the simplest part of Git.
- Click the green
Code
button above, click the HTTPS link, and copy the link. - Initiate a command in your favortite IDE (interactive development environment) to
clone
the respository using the link you just copied. Alternatively you can execute this command in the git bash prompt:git clone <the link you copied>
-
Create your branch: a branch is your personal working snapshop of the repository. We base all our new branches from dev, so make sure you are creating your branch from the latest commit in dev. To do this from git bash:
git checkout -b dev/<your-branch-name>
- Alternately you can create a new branch from any other branch. Just make sure you base the branch from /dev
-
Make sure everything is good: Issue a
git status
. You should see that you are currenly on your branch and yourWorking tree is clean
-
Make your changes: change the files you need to change. These changes are equivalent to developing a feature. For this "feature", your requirements are as follows:
- add a new file that contains your biography. You must have a link to ALL_BIOS.md at the end of your biography
- add a link to ALL_BIOS.md with your name and the link to your new bio file
-
Test your solution on your local machine: Make sure everything is working in your local environment
-
Stage and commit your contributions
git add -A .
will stage all your changed filesgit commit -m "Your Message"
will create a commit (new snapshot) to your local repo with all the changes you made. "Your message" should briefly describe the changes you made. For example: "Created John's awesome biography"
-
Ask to contribute to the repo: You are about to release something awesome to the world. Use your GitHub account to register yourself as a contributor. (intrusctions TBD).
-
Pull the latest changes: A pull is a fetch plus merge (or rebase) from the remote repo. issue a
git pull
command to make sure you have everyone's latests stuff. This is a great practice to reduce the chances of merge conflicts (more on this later) -
Push your new branch to the remote repo:
- issue a
git push
. - naviate to the GitHub repo (link from step 2)
- click the branches dropdown. Your new branch should be in the list
-
Issue a pull request From the main GitHub screen, click the Pull Requests button and click
New Pull Request
. Set thebase:
value to dev, and setcompare:
to your new branch. Then clickCreate Pull Request
. -
Participate in your peer review: Reviewers will get a notification that you initiated a Pull Request. Your reviewer will look at your changes where they can accept, reject, or leave comments for you. When the reviewer has approved your PR, then they will issue a merge commit to merge your changes with everything in dev.