Skip to content
Versora

Manual

Branches and remotes

Push and publishing a branch

6 min read

On this page

Push sends to the remote the commits that only exist on your local branch. In Versora it works for the checked-out branch and also for any other local branch, without switching branches. Before sending, the app checks secrets, protected branches, push rules and the CI file. That way the server doesn't reject the push after the commits have already left your machine.

This page covers the regular push. Force push, Sync and push without hooks have their own pages: Force push, Sync and Skip hooks.

Push the current branch

The everyday case is sending the commits of the branch you're working on. The Push button on the bar shows, in a badge, how many commits the branch is ahead of its upstream.

Where to find it

  • The repository bar: the Push button (tooltip: "Push the current branch").
  • The repository bar: the arrow next to Push (Push options) › Push.
  • The current branch's menu (right-click in the left panel or on the graph label): Push.
  • Palette (Ctrl+P): "Push" (detail: "Pushes feature/login to the remote").
  • There's no default shortcut. You can assign one in Preferences › Keyboard shortcuts (see Customization).

Step by step

  1. Check out the branch you're going to send (for example, feature/login).
  2. Click Push.
  3. Versora runs the push checks. While they run, the bar shows "Checking before push…".
  4. If nothing is found, the push starts. The bar shows "Pushing…", git's phase (for example, "Writing objects") and the percentage. The Cancel button interrupts the upload.
  5. At the end, the notice "Pushed feature/login to origin/feature/login" shows up.

What Versora does in git

With the upstream set, the app runs push with no arguments, which sends the current branch to its upstream:

bash
git push

What counts is the branch's upstream (see Upstream). HTTPS credentials come from Git servers or, for hosts that aren't registered, from your git's credential helper (see Git servers). SSH remotes use your SSH keys.

Publish a new branch

A branch created in Versora doesn't exist on the remote yet. On the first push, the app asks which remote it goes to and makes the branch track the newly created remote branch right away.

Step by step

  1. With the new branch checked out (for example, feature/relatorio), click Push.
  2. The Publish branch dialog opens, with the message ""feature/relatorio" doesn't have a remote branch yet."
  3. In Remote, choose the destination. Each option shows the remote's name and address. The first one on the list comes already selected.
  4. Click Publish and push.
  5. After the checks and the upload, the notice "Published feature/relatorio to origin" shows up.

What Versora does in git

bash
git push -u origin feature/relatorio

-u records the upstream: the branch's next pushes and pulls already know where to go.

A repository with no remote at all

If the repository doesn't have a remote yet, Push has nowhere to send to:

  • with a GitLab or GitHub registered with a token in Git servers, Publish repository opens, which creates the project on the server, adds the remote and pushes. That first push goes through the same checks as any push (the ones on this page, further below), before the project is created (see Publish repository);
  • without a registered server, Add remote opens (see Remotes).

Push another branch, without checkout

From the menu of any branch, you can send a local branch that isn't checked out. The working directory and the current branch don't change.

Where to find it

  • The menu of a local branch that isn't the current one: Push.
  • In a commit's menu, the submenu named after each local branch pointing to it also has Push.

How it works

  • With an upstream, the branch goes to the remote branch it tracks. At the end, "Pushed feature/a to origin/feature/a" shows up.
  • Without an upstream, the same Publish branch dialog opens, and the branch starts tracking the newly created remote branch.
  • With no remote in the repository, the notice "This repository doesn't have a remote configured yet." shows up.

What Versora does in git

bash
# branch with an upstream of the same name
git push origin feature/a

# branch with an upstream of another name (feature/a tracks origin/feature/a-v2)
git push origin refs/heads/feature/a:refs/heads/feature/a-v2

# branch without an upstream (publish)
git push -u origin feature/a

Push by dragging a branch

Dragging a local branch onto a remote branch, or onto a remote's name in the REMOTE section, opens a menu with "Push feature/a to origin". The details are in Dragging branches.

What is checked before the push

Before any push (from the button, the menu, dragging or the merge request form), Versora runs the push checks. If any of them finds something, the Before pushing dialog shows up with the list grouped by check. Push anyway goes ahead; Cancel goes back without sending anything.

CheckWhat it looks atPage
Secretstokens, keys and passwords in the added lines of the commits the remote doesn't have yetSecrets
Protected brancha direct or forced push to a branch protected on the server or on the repository's listProtected branches
Push rulesmessage, email, signature, Signed-off-by, branch name and file sizePush rules
CI validationthe .gitlab-ci.yml, when a pushed commit changes that fileValidate CI

Some checks open a dialog of their own, with the fix ready (for example, renaming the branch to the required pattern). Each one can be turned on or off in Preferences.

After the push: create the merge request

When the repository is linked to a GitLab or GitHub with a token, right after the push the notice "Pushed feature/login." shows up in the corner of the graph, with the Create merge request button (on GitHub, Create pull request). It goes away on its own after 20 seconds, or with the ×.

The notice doesn't show up:

  • for the project's default branch (for example, main);
  • if the branch already has an open merge request;
  • when the push was made by the "Create merge request" form itself.

See Create a merge request.

How to undo

Ctrl+Z doesn't undo a push. Versora's undo restores local branches, tags, HEAD and stashes, and a push doesn't change any of that: what changes is the server.

To go back after sending:

  • prefer reverting the commit and pushing again (see History);
  • if nobody has fetched the commits yet, you can rewrite the local branch and do a force push.

Caution

A push to a shared branch is seen by your colleagues on their next fetch. Before rewriting what has already been sent, talk to the team.

Caveats and messages

  • "Push isn't available in detached HEAD.": no branch is checked out. Check out a branch or create one from the current commit.
  • "This repository doesn't have a remote configured yet.": pushing another branch needs a remote. Add one in REMOTE › Add remote.
  • "The pre-push hook refused the operation.": a repository hook blocked the upload. The notice comes with Try without hooks (see Skip hooks).
  • "Tip: add this server's credential under "Git servers" (key icon).": the server refused the authentication. Register or update the host's token.
  • "your company's policy doesn't allow the server gitlab.exemplo.com (allowed: …)": the remote points to a server outside the list allowed by the company policy.
  • "Wait for the current operation to finish.": another operation is already running in this repository.
  • A server refusal because a pull is missing (the remote has commits you don't have): pull or use Sync.
  • Push after committing: in the commit box, under Commit options. The default is in Preferences › Commit › Push after commit (see Commits).
  • Checks: Preferences › Checks, Preferences › Push rules and Preferences › CI validation.
  • Company policy: allowed_servers restricts the servers accepted in every git network command; secrets_scan locks secret scanning; protected_branches adds protected branches. See Administrators.

See also