Branches and remotes
Create, rename and delete branches
6 min read
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.
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.
- 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.
- 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").
- In Branch name, type the name. Spaces become hyphens: "fix login" becomes
fix-login. - Leave Check out the new branch checked to start working on it right away, or uncheck it to just create it.
- Click Create.
| Option | What it does | Default |
|---|---|---|
| Branch name | The new branch's name. Spaces become -. | empty (required) |
| Check out the new branch | Creates and switches to the new branch in the same step. | checked |
# 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).
Ctrl+Z undoes "Create branch feature/relatorio": the branch is deleted and, if there was a checkout, HEAD goes back to where it was.
Renaming changes only the local branch's name. The commits don't change.
- 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.
- Open the branch's menu and choose Rename feature/relatorio….
- In the Rename feature/relatorio dialog, edit the New name field.
- Click Rename. If the name didn't change, nothing happens.
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).
Ctrl+Z undoes "Rename branch feature/relatorio" and brings back the old name.
- 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.
- Choose Delete feature/relatorio….
- The Delete feature/relatorio dialog warns "The local branch will be deleted."
- 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.
- Click Delete.
| Option | What it does | Default |
|---|---|---|
| Delete even if it has unmerged commits (-D) | Deletes it even if the commits only exist on that branch. | unchecked |
git branch -d feature/relatorio # default
git branch -D feature/relatorio # with the box checked
Ctrl+Z undoes "Delete branch feature/relatorio": the branch points to the same
commit again, even after a -D.
- "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
-Dbox, or merge it first.
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.
- 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.
- Choose Delete origin/feature/relatorio….
- The dialog warns: "Branch "feature/relatorio" will be deleted from remote "origin" for everyone. This can't be undone from here."
- Click Delete from remote.
git push origin --delete feature/relatorio
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.
- 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.
- 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."
- Click Delete both.
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.
Ctrl+Z gives back only the local branch. The remote's branch stays deleted.
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).
The branch menu has more actions, explained on each one's page:
- Pull (fast-forward), Push, Force push…, Set upstream…: Pull, Push, Force push, Upstream.
- Check out feature/relatorio and the Checkout submenu: Checkout.
- Merge, squash merge and rebase onto the current branch: Merge and rebase.
- Creating a merge request: Create a merge request.
- Branch stack: Stacks.
- Create worktree from: Worktrees.
- Hiding, solo and pinning to the left in the graph: Graph.
- Archiving, cleaning up and reviewing branches: Hygiene and flow.
- Create tag here… and Create annotated tag here…: Tags.
- "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.