Skip to content

dev07 creating feature branch and merging to dev

Deron Smith edited this page Jun 8, 2018 · 2 revisions

Feature Branching

Updated 06/08/2018

Feature branching with Git and Github is the process of creating a new branch when working on a new 'feature'. A feature is anything from a small update to a html template, to a completely new url endpoint in flask. The primary difference between regularly updating github with a push to 'dev' branch is that feature branching removes the possibility for partial/incomplete pushes into properly functioning branch. All branches that are being deployed to a server, master, staging and dev, should not have updates pushed directly to them.

Steps

All the follow commands assume that the github project has already been cloned to your machine.

  • From the commandline go to your local git repo for the project you are working on.
  • Checkout dev branch on your local machine
    git checkout dev
    
  • Pull latest updates on dev branch
    git pull origin dev
    
  • Create new feature branch locally, feature branch names should be descriptive of the issue/feature the branch is for.
    git checkout -b NEW_BRANCH_NAME
    
  • Push new branch and any updates to github
    git push origin NEW_BRANCH_NAME
    
  • Once the feature has been completed, merge the feature branch back into dev
    git checkout dev
    git merge NEW_BRANCH_NAME
    
  • Resolve any conflicts with the merge then push the update to github
    git push origin dev
    
  • After verifying that all updates from the feature branch have successfully been merged into dev, delete feature branch
    git branch -d NEW_BRANCH_NAME