This has been my guide for Git branching for my projects.

A condensed version with some of my own additions:

Main Branches

Origin should have two main repo’s, “master” and “dev” (“develop”, “development”, whatever you prefer).

master is always stable, production ready.  Pull Requests should be to dev branch.  Features (discussed below) should also be pushed to dev before before a release to master/production.


Feature branches should be merged into dev with –no-ff so everything is packaged together.

Start by creating your feature branch with git checkout -b myfeature dev

After work is done and you’re feature is ready:

  1. git checkout dev
  2. git merge –no-ff myfeature
  3. git branch -d myfeature
  4. git push origin dev


Cutting a release consists of grabbing the dev branch at a certain point and merging that into master.

  1. git checkout -b release_name dev
  2. Update a version file and commit if one exists
  3. git checkout master
  4. git merge –no-ff release_name
  5. git tag -a release_name_or_number
  6. git checkout dev
  7. git merge –no-ff release_name
  8. git branch -d release_name


Hot/bugfixes can be done on master, just be sure to also merge and push to dev.

  1. git checkout -b hotfix_name master
  2. git checkout master
  3. git merge –no-ff hotfix_name
  4. git tag -a release_name_or_number
  5. git checkout dev
  6. git merge –no-ff hotfix_name
  7. git branch -d hotfix

Keeping local branches up to date

  1. git checkout dev
  2. git pull origin dev
  3. git checkout your_local_branch_name
  4. git merge dev

Merge Conflicts

DiffMerge is a good visual tool. Here’s how to set it up.

Reverting a Merge

This is when doing a merge for your features makes a lot of sense because you can easily rollback an entire feature with git revert -m 1 merge_sha