Project Workflow with Git - AVanDeBrook/citation-graph GitHub Wiki

Project Workflow with Git

The master branch will rarely be directly committed to. Generally we should create a new branch to work on each story card/issue. Once the necessary changes have been made, create a Pull Request so the changes can be reviewed, fixed, and merged.

Example Process

Starting a Story

Update your local branch so that you have the most recent project code (git pull) and create a new branch off of that (git checkout) for the story card you are working on:

$ git pull && git checkout -b <branch-name>

For this project, we'll use the branch naming convention lastname-storynumber. For example:

$ git pull && git checkout -b delgreco-6

Development work

What to do after you've made your changes? As a general rule, stage often to prevent data loss and commit when your code is working. Here's a nice shortcut for staging all files:

$ git add .

And here is the general commit form:

$ git commit -m "<commit-message>"

When you want to publish what you have locally so other people can see it online, use the following form:

$ git push -u origin <branch-name>

or just simply:

$ git push

If the master branch has been updated since you first branched off of it to start your story, you can ensure your branch is up to date with this:

$ git pull origin master

Completing a Story

When you're finished and have pushed all of your changes, create a Pull Request on GitHub to have your changes reviewed and merged into the master branch.

  • Two other team members must review and approve your Pull Request.
  • Address any comments, fix your code (stage, commit, and push your fixes).
  • When there's two approvals and you see it fit, you merge your own branch into the master branch.