How to Git: a Brief Guide to Making Open-Source Contributions ft. Bridge Troll

Get Started

Totally new to git? GitHub has a great introduction at learn.github.com. We're assuming you have git installed and a basic understanding of using git locally for the purposes of this page.

If you haven't already, configure things:

Make your fork: go to the project's GitHub repo and click the Fork button.

Now, clone it to your machine, replacing {username} with your GitHub username:

Start working in the project directory:

Add the main project repo as an upstream remote so you can pull updates:

Work on your Code

Make and name a new feature branch:

Now write your code!

Stay up to date

You can either wait until you make your pull request to deal with any merge conflicts, or you can update your feature branch as pull requests are merged. If you update while working on your feature, you'll need to commit your work in progress.

To update your feature branch, pull in upstream changes while on that branch:

You can also do these things in a single command that fetches from the URL tracked by the current branch and immediately tries to merge in the tracked branch: