Skip to main content

Appendix D Cheat sheet for contributing to a project

You have forked a repository and cloned your fork to your laptop. You have origin as a remote to your fork, and upstream as a remote to the official repository for the project. Below are all the steps you typically need for contributing to the project.

  1. git checkout master

  2. git pull upstream master

    Now you are on your master branch and have the latest version of the project.

  3. git branch <branchname>

  4. git checkout <branchname>

    Now you are on a new branch called <branchname>.

  5. Make the changes you planned. When appropriate do

    git add <file1> <file2> ...

    git commit -m "useful commit message"

  6. Check your work: run latex, or compile the code, or whatever is appropriate for the project. Save yourself the embarrassment of having a pull request rejected because you submitted something broken!

  7. git pull upstream master

    Do that in case new material has been added since the last time you pulled. If you pulled in new material, it can't hurt to repeat step Item D.0.1:6.

  8. git push origin <branchname>

    And then go to your fork on GitHub and make a pull request..

    Be sure to describe how to see your changes in the final product.

  9. When in doubt, do git status to find out what branch you are on, and to see if there are uncommitted changes.