Mike Slinn

Connoisseur of Technology

Working With Bug Fix and Feature Branches in Git

2011-08-18 / All Blog posts

The project I am currently leading is following A Successful git Branching Model with only a few modifications.

Create a Bug Fix / New Feature Branch

When a developer goes to work on a new task, bug or feature they should make new branch from the develop branch to start their work. The new branch will be named after the Jira task ID.

git checkout develop               // make develop branch current
git pull                           // get latest commits
git checkout -b EDOC-1234 develop  // make new EDOC-1234 branch

That creates a new branch for you in your local repository named EDOC-1234 based on the develop branch where everyone’s latest work is checked in. From there you can work on your new feature. For example:

echo "42">>theAnswer.txt
add theAnswer.txt
commit -m "The answer to life, the universe and everything"
echo "43">>yetMore.txt
add yetMore.txt
commit -m "A present for the god who has everything: one more thing beyond 42"

Update your Bug Fix / Feature Branch with the Latest From the develop Branch

If someone commits to the develop branch while you are working on your feature you can get their work by (re)merging the develop branch to your EDOC-1234 branch:

git checkout develop     // switch to the develop branch
git pull origin develop  // pull the latest changes from the develop branch at origin
git checkout EDOC-1234   // switch back to your feature branch
git merge develop        // add all the changes from the develop branch to your feature branch

Merge your Bug Fix / Feature Branch Back to the develop Branch

When you are done with your feature you need to merge it back the the develop branch.

git checkout develop          // switch the the develop branch
git pull origin develop       // pull the latest commits to the develop branch on origin
git merge --no-ff EDOC-1234   // merge the updates from the develop branch on origin
git push origin develop       // push your merged work to origin

Deleting a Bug Fix / Feature Branch

This will be done after the branch has had a code review and Q/A is complete.

git branch -d EDOC-1234       // remove your feature branch

Contact Mike Slinn

Unless you are a recruiter, in which case you should not try to make contact!

  • Email
  • Direct: 514-418-0156
  • Mobile: 650-678-2285

Disclaimer

The content on this web site is provided for general information purposes only and does not constitute legal or other professional advice or an opinion of any kind. Users of this web site are advised to seek specific legal advice by contacting their own legal counsel regarding any specific legal issues. Michael Slinn does not warrant or guarantee the quality, accuracy or completeness of any information on this web site. The articles published on this web site are current as of their original date of publication, but should not be relied upon as accurate, timely or fit for any particular purpose.

Accessing or using this web site does not create a client relationship. Although your use of the web site may facilitate access to or communications with Michael Slinn via e-mail or otherwise via the web site, receipt of any such communications or transmissions does not create a client relationship. Michael Slinn does not guarantee the security or confidentiality of any communications made by e-mail or otherwise through this web site.

This web site may contain links to third party web sites. Monitoring the vast information disseminated and accessible through those links is beyond Michael Slinn's resources and he does not attempt to do so. Links are provided for convenience only and Michael Slinn does not endorse the information contained in linked web sites nor guarantee its accuracy, timeliness or fitness for a particular purpose.


comments powered by Disqus

© 1976-2020, Michael Slinn. All rights reserved.