Skip to content

Instantly share code, notes, and snippets.

@bajtos
Last active January 3, 2017 15:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bajtos/27e3d1545a053d22015b to your computer and use it in GitHub Desktop.
Save bajtos/27e3d1545a053d22015b to your computer and use it in GitHub Desktop.
Introduction to GitHub workflow

This article provides much better and more detailed instructions:

http://www.nearform.com/nodecrunch/first-time-with-open-source/


Set up a local clone

Here is my setup, but feel free to use whatever works best for you. You need to run this once for each new repository (project) you fork on GitHub:

  1. Fork a repo via Github UI (e.g. strongloop/loopback -> bajtos/loopback). For more detailed instructions, see GitHub's Fork an example repository. Ignore GitHub's instructions for setting up a local clone, follow my instructions below.

  2. Clone the forked repo locally, this creates remote called "origin"

git clone git@github.com:bajtos/loopback.git
cd loopback
  1. Add upstream remote
git remote add upstream git@github.com:strongloop/loopback.git
  1. Configure master to track upstream (strongloop), not your fork:
git config branch.master.remote upstream

Now you are set to create a new feature branch, see below.

Work with Git branches

Whenever you start working on a new pull request, create a new feature branch dedicated to this pull request.

Here are the most important commands:

  1. create a new branch
git checkout -b branch-name
  1. push the new branch to github
git push -u origin branch-name
  1. switch to a different branch
git checkout another-branch-name

See the following page for more info, you can ignore the merging part: http://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

Send a GitHub pull request

To get you started with pull-request based workflow:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment