Skip to content
Versora

Manual

Branches and remotes

Create, rename and delete branches

6 min read

On this page

A branch is a name that points to a commit and moves along with new commits. In Versora, local branches are in the LOCAL section of the left panel and remote ones in REMOTE, grouped by remote. Names with a slash (for example, feature/login) show up as folders.

This page covers a branch's life cycle: creating, renaming, deleting and copying its name or link. To switch branches, see Checkout.

Create branch

You create a branch to isolate a piece of work: a fix, a feature, an experiment. The new branch starts from a commit (HEAD, any commit in the graph, a tag) and, by default, is checked out right away.

Where to find it

  • The repository bar: the Branch button (tooltip: "Create a branch from HEAD").
  • Left panel: the + in the LOCAL section header (tooltip: "Create branch").
  • Palette (Ctrl+P): "Create branch…" (detail: "From the current commit (HEAD)").
  • The menu of a commit, a branch or a remote branch: Create branch here…. In the graph, that item opens the dashed ghost branch on the commit's own row (see Graph).
  • A tag's menu: Create branch here… (the branch starts from the tag's commit).
  • Reflog: Create branch on an old point, to recover commits (see Inspection).
  • To start working on an issue, with the name following the repository's template, use Start work.

Step by step

  1. Choose one of the entries above. The Create branch dialog opens. When the starting point isn't HEAD, the message says where it comes from (for example, "From v1.4.0" or "From 3f2a9c1").
  2. In Branch name, type the name. Spaces become hyphens: "fix login" becomes fix-login.
  3. Leave Check out the new branch checked to start working on it right away, or uncheck it to just create it.
  4. Click Create.
OptionWhat it doesDefault
Branch nameThe new branch's name. Spaces become -.empty (required)
Check out the new branchCreates and switches to the new branch in the same step.checked

What Versora does in git

bash
# with "Check out the new branch" checked
git checkout -b feature/relatorio            # from HEAD
git checkout -b hotfix/1.4.1 v1.4.0          # from a tag or commit

# without checkout
git branch feature/relatorio 3f2a9c1

The new branch doesn't exist on the remote yet. The first push publishes it (see Push).

How to undo

Ctrl+Z undoes "Create branch feature/relatorio": the branch is deleted and, if there was a checkout, HEAD goes back to where it was.

Rename branch

Renaming changes only the local branch's name. The commits don't change.

Where to find it

  • The local branch's menu: Rename feature/relatorio….
  • In a commit's menu, the submenu of each branch pointing to it also has this item.

Step by step

  1. Open the branch's menu and choose Rename feature/relatorio….
  2. In the Rename feature/relatorio dialog, edit the New name field.
  3. Click Rename. If the name didn't change, nothing happens.

What Versora does in git

bash
git branch -m feature/relatorio feature/relatorio-mensal

Git takes the branch's configuration along (upstream and, in a stack, the recorded parent).

Caution

The remote branch keeps the old name, and the upstream still points to it. For the server to have the new name too, publish the renamed branch and delete the old one on the remote (see below and Upstream).

How to undo

Ctrl+Z undoes "Rename branch feature/relatorio" and brings back the old name.

Delete a local branch

Where to find it

  • The local branch's menu: Delete feature/relatorio…. The item is disabled on the current branch: check out another one first.
  • In a commit's menu, each local branch's submenu also has the item.

Step by step

  1. Choose Delete feature/relatorio….
  2. The Delete feature/relatorio dialog warns "The local branch will be deleted."
  3. If the branch has commits that haven't gone into any other branch, check Delete even if it has unmerged commits (-D). Without that box, git refuses.
  4. Click Delete.
OptionWhat it doesDefault
Delete even if it has unmerged commits (-D)Deletes it even if the commits only exist on that branch.unchecked

What Versora does in git

bash
git branch -d feature/relatorio     # default
git branch -D feature/relatorio     # with the box checked

How to undo

Ctrl+Z undoes "Delete branch feature/relatorio": the branch points to the same commit again, even after a -D.

Caveats and messages

  • "Branch feature/relatorio has commits that haven't been merged into any other branch. To delete it anyway, use the -D option.": open the dialog again and check the -D box, or merge it first.

Delete a remote branch

Deleting a branch on the remote applies to everyone who uses that remote. Use it to clean up a branch whose merge request has already gone in.

Where to find it

  • A remote branch's menu (REMOTE section or an origin/… label in the graph): Delete origin/feature/relatorio….
  • The menu of a local branch that has a branch with the same name on the remote: Delete origin/feature/relatorio….
  • In a commit's menu, each remote branch's submenu.

Step by step

  1. Choose Delete origin/feature/relatorio….
  2. The dialog warns: "Branch "feature/relatorio" will be deleted from remote "origin" for everyone. This can't be undone from here."
  3. Click Delete from remote.

What Versora does in git

bash
git push origin --delete feature/relatorio

How to undo

Ctrl+Z doesn't bring the branch back to the server. If the commit still exists on your machine (on a local branch or on the origin/… label before the next fetch), publish it again with a push.

Delete the local and the remote one at once

Where to find it

  • The menu of a local branch that has a branch with the same name on the remote: Delete feature/relatorio and origin/feature/relatorio…. Disabled on the current branch.

Step by step

  1. Choose the item. The Delete feature/relatorio and origin/feature/relatorio dialog explains: "Local branch "feature/relatorio" and branch "feature/relatorio" on remote "origin" will be deleted. The deletion on the remote applies to everyone."
  2. Click Delete both.

What Versora does in git

bash
git push origin --delete feature/relatorio
git branch -D feature/relatorio

The remote one is deleted first. If that part fails (no permission, branch protected on the server), the local branch stays as it was. The local deletion uses -D: it doesn't refuse for lack of a merge.

How to undo

Ctrl+Z gives back only the local branch. The remote's branch stays deleted.

Where to find it

In the branch's menu (local or remote):

  • Copy branch name: copies feature/relatorio.
  • Copy commit SHA: copies the SHA of the branch's tip.
  • Copy link to branch: origin/feature/relatorio: the branch's address on the remote's page. It shows up when the branch has a counterpart on the remote.
  • Copy link to this commit on remote: origin: the address of the tip commit on the remote's page.

Both links are built from the remote's URL (HTTPS or SSH). The default format is GitLab's, including self-hosted. GitHub, Bitbucket and Gitea/Forgejo are recognized by the host name.

  • Copy Versora link to branch: feature/relatorio: a versora:// link that opens Versora right on that branch, on your machine or a colleague's (see Windows).

Other items in the branch menu

The branch menu has more actions, explained on each one's page:

Caveats and messages

  • "Wait for the current operation to finish.": another operation is running in this repository.
  • A name refused by git: git doesn't accept some characters (~, ^, :, ?, *, [, \), .. or spaces. Versora already replaces spaces with -; in the other cases, the notice shows git's message. Fix the name and try again.
  • Protected branches (a warning when committing or pushing to main, for example): Preferences › Checks. See Protected branches.
  • Deleting in bulk the branches that have already gone in: Hygiene and flow.

See also