Triangular workflow in Git

Start by forking the repository, and then cloning the forked version of the repository to your computer. We use a triangular workflow - you should push to your fork, but fetch/pull from the Code for DC repo. Setting this up is easy. Use these commands:

$ git clone <url-of-your-fork>
$ cd housing-insights
$ git remote add codefordc
$ git remote -v
  #you should see this:
  codefordc (fetch)
  codefordc (push)
  origin          <your/forked/url> (push)
  origin          <your/forked/url> (fetch)

Now instead of plain git push and git fetch, use these:

$ git push origin <branch-name>       #pushes to your forked repo
$ git fetch codefordc <branch-name>   #fetches from the codefordc repo

Here’s more information on setting up triangular workflows (scroll to “Improved support…”).

Never worked with a triangular workflow before? Ask a project lead for help.