Skip to content
Versora

Manual

Branches and remotes

Dragging branches

6 min read

On this page

Dragging one branch onto another is the shortest way to combine or send work. When you drop it, Versora works out the relationship between the two branches (which one is ahead of which) and shows only the actions that make sense in that case.

This works in the left panel (LOCAL, GITFLOW and REMOTE sections) and with the branch labels in the graph. This is the main page about dragging a branch. For dragging commits (cherry-pick and rebase of commits) and for how dragging works in general (when it starts, how to cancel, scrolling near the edge), see Dragging branches and commits.

Where to find it

  • Left panel: drag a branch row from the LOCAL, GITFLOW or REMOTE section and drop it onto another.
  • Graph: drag a branch's label and drop it onto another's label. Dragging the label drags the branch; dragging the rest of the row drags the commit.
  • REMOTE section: drop a local branch onto the remote name (for example, origin). The remote row's tooltip shows the URL and reminds you: "Drag a local branch here to push it".

Step by step

  1. Press the left button on the source branch (the one that will go in or be sent).
  2. Drag it to the destination branch. The destination is highlighted and the label next to the cursor says "source → target" (for example "feature/login → main").
  3. Drop it. A menu opens with the possible actions. To give up, press Esc before dropping or drop outside a target.
  4. Choose the action. Before it runs, the same checks as in the menus apply (conflict prediction on merge and rebase, checks before the push).

Example: update release/1.4 with main, without switching branches

  1. Drag main (in the panel or in the graph) onto release/1.4.
  2. Choose Fast-forward release/1.4 to main.
  3. release/1.4 moves forward. You stay on the branch you were on.

Example: bring main into feature/login

  1. Drag main onto feature/login.
  2. Choose Merge main into feature/login. If you're not on feature/login, the item ends with "(checks out feature/login)" and the app checks it out first.
  3. If conflict prediction finds a conflict, the Before merging window shows the files. Choose Merge anyway or Back.

Example: publish a branch to a remote

  1. Drag feature/login from the LOCAL section to the origin folder in the REMOTE section.
  2. Choose Push feature/login to origin.
  3. The app runs the checks before the push (secrets, protected branch, push rules, CI file). If any of them finds something, the window shows what was found before sending.
  4. When it finishes: "Pushed feature/login to origin".

What shows up in the menu

A local branch onto another local branch

Dragging feature/login onto main:

SituationMenu items
Both on the same commit"feature/login and main are already on the same commit" (disabled)
main has no commits of its own and is behindFast-forward main to feature/login and Merge feature/login into main
Both have movedMerge feature/login into main and Rebase feature/login onto main
main already contains feature/loginRebase feature/login onto main and "main already contains feature/login" (disabled)

When the action needs a branch that isn't checked out, the item says so in parentheses, for example "Merge feature/login into main (checks out main)".

A remote branch onto a local branch

Dragging origin/main onto main, the menu offers Fast-forward main to origin/main (when main is only behind) and Merge origin/main into main. Rebase only shows up when the dragged branch is a local one.

A local branch onto a remote branch or onto a remote

  • Onto the remote name (origin): Push feature/login to origin. If the branch doesn't have an upstream yet, it starts tracking the branch created on the remote.
  • Onto a remote branch (origin/feature/login-v2): Push feature/login to origin/feature/login-v2. If the remote branch has commits the local one doesn't have, Merge origin/feature/login-v2 into feature/login and Rebase feature/login onto origin/feature/login-v2 also show up.

Combinations with no action

Dragging a remote branch onto another remote branch, for example, shows "No actions available for this combination".

What Versora does in git

bash
# Fast-forward main to feature/login
git merge --ff-only refs/heads/feature/login          # main checked out
git fetch . refs/heads/feature/login:refs/heads/main  # main not checked out

# Merge feature/login into main (checks out main first, if needed)
git checkout main --
git merge --no-edit feature/login

# Rebase feature/login onto main (git itself checks out feature/login)
git rebase main feature/login

# Push feature/login to origin/feature/login-v2
git push origin refs/heads/feature/login:refs/heads/feature/login-v2
# without an upstream, with -u

Fast-forwarding a branch that isn't checked out doesn't touch the working directory: it only moves the branch. Before the merge and the rebase, the app simulates the operation in memory (git merge-tree) to predict conflicts; the simulation doesn't change anything in the repository. If the local branch doesn't have an upstream yet (or the upstream is gone), the push also makes it track the destination remote branch, like git's -u.

How to undo

  • Fast-forward, merge and rebase: each one is a single operation in the undo history, and Ctrl+Z undoes the whole operation: the fast-forward ("Fast-forward release/1.4"), the merge, including the checkout done beforehand ("Merge main into feature/login"), or the rebase ("Rebase feature/login onto main").
  • A merge or rebase that stopped at a conflict: while it's stopped, Abort on the operation bar puts everything back as it was. If you resolve it and finish (Continue, or the commit that concludes the merge), the operation goes into Ctrl+Z as a whole, like one that didn't stop: undo goes back to the state before it, including the checkout. If aborted, nothing goes into the history.
  • Push: Ctrl+Z doesn't undo a push (see Push).

See Undo and redo.

Caveats and messages

  • Merge and rebase go through conflict prediction. If it finds a conflict, Before merging or Before rebasing opens, with the files. See Predict conflicts before operating.
  • Mind the direction: a merge is always of the source into the target and a rebase, of the source onto the target. Dragging main onto feature/login may offer "Rebase main onto feature/login", which would rewrite main. Read the item before clicking.
  • Merge and rebase with a checkout need your local changes not to get in the way of switching branches.
  • Rebase rewrites the source's commits. If they were already on the remote, the next push has to be forced. See Force push.
  • If a hook refuses the rebase, the error notice offers Try without hooks. See Skip hooks.
  • If the merge or the rebase stops at a conflict, see Stopped merge, rebase, cherry-pick and revert.
  • The push goes through the push checks (secrets, protected branch, push rules, CI). See Checks.
  • A push to a remote branch with another name creates or updates that branch on the server: dropping feature/login onto origin/main sends it to the remote's main (feature/login:main) and, without an upstream, starts tracking it. Check the destination before dropping.
  • The push by dragging isn't forced. If the remote has commits the local one doesn't have, the server refuses: first use the merge or rebase items in the same menu, or Force push… from the branch's menu.
  • Conflict prediction: Preferences › Checks › Before merging or rebasing › Warn when it would conflict ("From the menu or by dragging one branch onto another."), on by default. The prediction needs git 2.38 or newer (see Git version).
  • The checks before the push and the protected branch block follow Preferences and the company policy. See Checks.
  • Dragging branches has no switch to turn it off. The Preferences › Graph › Mouse › Drag commits option only applies to commit rows.

See also