As important as it is to "pull before you push," this process can slow down your development workflow. Branching allows you to work in your own scratch space and then perform a larger merge once you've finished your changes.

A branch represents a separate line of development that is created from a commit in another branch. It allows you to work on a parallel line of code and later merge your changes back to the original branch. When you switch between branches, you are performing a "checkout" of that branch and so your local development files will change accordingly.

Most often, engineers engaging in feature development will be:

  1. Creating a new feature branch

  2. Making changes on that new branch

  3. Opening a pull request and engaging in code review

  4. Merging their feature branch back into the main branch

Each feature branch can be thought of as a temporary deviation from the main branch. Eventually, all feature branches have the shared goal of merging their features back into the main branch.

If you do want to read more, we recommend consulting both Git's Official Documentation and the Learning Git Branching Game.

Creating a New Branch

You can only create new branches from the Desktop App.

To create a new branch, click into the Current Branch dropdown and select the New Branch button.

After labeling your new branch, click the Create Branch button.

At this point, your new branch only exists on your local machine. To publish to the Copia server, click either of the Publish Branch buttons.

Renaming a Branch

Although the Desktop App offers a Rename... option, this operation only renames the branch locally and it won't impact the remote repository unless other collaborators pull the update and remove the old branch from their system individually.

When renaming a branch, it is smarter and safer to create a new branch from the old branch and then delete the old branch.

It is good practice to perform a Fetch operation prior to making any branch changes. This way you can ensure that local and remote are in sync.

Click into the Current Branch dropdown and select the branch you wish to rename. Press the New Branch button.

Provide a name for the the new branch. Select the branch to base your new branch on and click the Create Branch button_._

Publish the new local branch to the Copia remote server by clicking either of the Publish Branch options.

Select the Current Branch dropdown, right-click on your old branch, and delete it by clicking the Delete... option.

Check the Yes, delete this branch on the remote option and press the Delete button.

Be sure to alert anyone else using this branch so that they can update their local repository accordingly.

Last updated