Branches

Create an independent line of work.

Branching enables you to work with your peers without one affecting one other's body of work. For example, you can develop a new feature in one branch while one of your colleagues fixes a bug in another branch.

Create a branch

Create a new branch using the Git interface

Switch between branches

Switch between branches using the Git interface

Branch naming conventions

By having a clear and understandable naming scheme for your branches, you can:

  • Quickly understand the purpose of a branch.
  • Identify which branches are associated with which features, bugs, or tasks.
  • Make it easier to navigate the project and find relevant work.

While the specific conventions can vary between teams or projects, good branch naming conventions generally share these attributes:

  1. Descriptive: A good branch name will instantly tell you what is being worked on in that branch.
  2. Consistent: Consistency makes it easier to understand what each branch is for, especially for newcomers to the project.
  3. Short: Shorter names are easier to type and to read.
  4. Punctuated for readability: This typically means using hyphens, underscores, or slashes to separate different parts of the name.

Here's an example of a branch naming convention that embodies these principles:

  • feat-<feature-name> for new features (e.g., feat-user-authentication).
  • fix-<bug-name> for bug fixes (e.g., fix-login-issue).
  • docs-<topic> for documentation (e.g., docs-installation-instructions).
  • test-<testing> for anything related to testing (e.g., test-user-model).

FAQ

How often should I create new branches in my project?