How to do it...

Perform the following steps to manage your local branches:

  1. Whenever you start working on a bug fix or a new feature in your project, you should create a branch. You can do so using the following code:
$ git branch newBugFix 
$ git branch 
* master 
 newBugFix 
  1. The newBugFix branch points to the current HEAD you were on at the time of the creation. You can see the HEAD with git log -1:
$ git log -1 newBugFix --format=format:%H 
25fe20b2dbb20cac8aa43c5ad64494ef8ea64ffc 
  1. If you want to add a description to the branch, you can do this with the --edit-description option for the git branch command:
$ git branch --edit-description newBugFix
  1. The previous command will open an editor where you can type in a description:
Refactoring ...

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.