Skip to content

Git Workflow [WIP]

Barak Stout edited this page Jun 29, 2020 · 7 revisions

Creating a local development environment

  • When you receive your cfpb laptop
  • Use the Quickstart instructions

Keeping Current With CFPB's Upstream

Development on CFPB's repository is ongoing. Our fork should be updated with their upstream changes at least once per week. In order to do this, you first need to set up CFPB's repo as a remote in your local clone of cfgov-refresh:

# initial
git remote add upstream https://github.com/cfpb/cfgov-refresh.git

# update
git remote set-url upstream https://github.com/cfpb/cfgov-refresh.git

The above command only needs to be run once per computer you've cloned the repo down to.

To keep Raft's master branch up to date with CFPB's do this:

git checkout master
git pull upstream master
# (resolve any merge conflicts and complete the merge)
git push origin master
git checkout my-money-calendar
git merge origin master
# (resolve any merge conflicts and complete the merge)
git push

Next, merge master into your mainline dev branch:

git checkout MAINLINE_DEV_BRANCH
git merge master
# (resolve any conflicts and complete the merge)
git push origin MAINLINE_DEV_BRANCH

Developing Features

Creating a mainline development branch

MAINLINE_DEV_BRANCH is the name of the branch you're using to submit PR's to CFPB from. It receives all PR merges from your feature branches. Mainline dev branches are created once per tool you're building, i.e. there's one for My Money Calendar, one for Cost of Credit Tool, etc.

# Checkout master and make sure your local HEAD is up to date with Raft's repo:
git checkout master
git pull

# Create a new mainline dev branch
git checkout -b MAINLINE_DEV_BRANCH
git push -u origin MAINLINE_DEV_BRANCH

Creating a feature branch

# Checkout mainline dev branch if not already on it
git checkout MAINLINE_DEV_BRANCH

# Create new feature branch and push to Raft fork
git checkout -b FEATURE_BRANCH_NAME
git push -u origin FEATURE_BRANCH_NAME

Integrating your branch into the Raft cfgov-refresh repo

  • After you have completed some work on your feature branch, add, commit and push to the github feature branch.
  • Submit a PR request from your feature-branch to the mainline development branch that has been created.
  • Get reviews, resolve conflicts and address comments.
  • When the lead reviewer approves the PR, they will complete the merge and let you know.
  • On the local side:
  • git checkout MAINLINE_DEV_BRANCH && git pull receives the latest changes from MAINLINE_DEV_BRANCH
  • git branch -D FEATURE_BRANCH Delete your local branch (optional)

Integrating the MAINLINE_DEV_BRANCH into cfpb cfgov-refresh repo

  • Go to Raft's cfgov-refresh fork and create a new PR
  • Select cfpb/cfgov-refresh as the base repo, and choose the branch with the same name as your mainline dev branch on Raft's fork.
  • Write and submit a PR for review by CFPB
  • Respond to an implement feedback
  • Get approval
  • CFPB will merge the branch and Continuous Integration will run automated tests
  • Follow CFPB instructions for deploying the branch to a development server
Clone this wiki locally