Skip to content

Git Rules

Cristian Aldea edited this page Feb 20, 2020 · 16 revisions

Git Rules

Branches

  • master: Production-ready branch. Can only be merged to using the PR model. Only develop can be merged to master.
  • develop: Development branch. Can only be merged to using the PR model. Only tasks, user stories, and bug branches can be merged to develop.
  • TASK-#: Task branches. Not all tasks need code to be edited, but if you do, please name it according to the Task number.
  • US-#: Feature branches. Used to develop new features for the project. Please name it according to the User Story number.
  • BUG-#: Used for bug fixing. Please name it according to the Bug number.

Creating a New Branch

We will be basing all our branches from the develop branch. Why not master? Because this way, you can pull all the other features that were not yet merged to master, but exist in develop.

  1. Go to your develop branch:
git checkout develop
  1. Pull all changes that were made:
git pull
  1. Create a new branch based off of develop:
git branch BRANCH-TYPE-#/Name-of-Branch
Ex: TASK-1/Ritchelle-PR
  1. Go to your new branch and start working from there:
git checkout BRANCH-TYPE-#
Ex: git checkout TASK-1/Ritchelle-PR

Commit Messages

  • It is important to note the branch type and number in the commit message (merged branches won't appear in develop and master's commit history, so this will help us with our git history in the long run). In today's standard, each commit message starts off with an action verb in present tense.
  • Also include the GitHub Issue number in your commit.
  • The issue number must be on the first line of your commit message!
Example commit message:
update README.md, references issue #4

Making a PR

  1. Go to our main repo page and click on: New pull request.
  2. Select your source branch to your destination branch (unless you're doing a PR from develop to master, you're always going to merge to develop as your destination branch).
  3. Set your PR description using this template:
Example PR description:
This PR references issue(s) #4
  1. Fix any merge conflicts.
  2. At least 1 teammate has to approve the PR before it gets merged.
  3. Once merged, close your GitHub issue.

Keeping Commits Clean

Please ensure your commits are clean before your PR is merged. Remember that you must:

  • Follow the commit template
  • Squash your commits and keep only the necessary messages

Zenhub User Story Template

As a <stakeholder>, I want to <feature> so that <value>.

ACCEPTANCE CRITERIA:
* criteria 1
* Must match [Mockup](link)