Skip to content
Versora

Manual

Hygiene and workflow

Gitflow

5 min read

On this page

Gitflow organizes work into two permanent branches, the production one (main) and the development one (develop), and three types of work branch:

  • feature: starts from develop and goes back to it;
  • release: starts from develop and finishes with a merge into main, a version tag and a merge back into develop;
  • hotfix: starts from main and finishes like the release.

Versora implements Gitflow directly on top of git, without needing the git flow extension installed. The configuration lives in the same gitflow.* keys as the extension, so a repository initialized by another tool is recognized by Versora, and vice versa.

There are two ways to use Gitflow in Versora:

  • through the GITFLOW section of the left panel, described on this page;
  • as the Gitflow preset of the workflow, which adds the bugfix type, the workflow health warnings and the WORKFLOW section in place of GITFLOW. The gitflow.* keys remain the source of the names and prefixes.

Initialize or configure Gitflow

Where to find it

  • GITFLOW section: "Gitflow isn't initialized in this repository." › Initialize Gitflow (disabled while the repository has no commits).
  • GITFLOW section already initialized: the Configure Gitflow button in the header.
  • Palette (Ctrl+P): "Gitflow: initialize…" or, if already initialized, "Gitflow: configure…".

Step by step

  1. Open Initialize Gitflow. The window explains: "Sets the branches and prefixes of the flow. The development branch is created if it doesn't exist yet."

  2. Fill in the fields (the defaults come already filled in):

    FieldDefault
    Production branchmain or master, whichever exists (otherwise, the current branch)
    Development branchdevelop
    Prefix for feature branchesfeature/
    Prefix for release branchesrelease/
    Prefix for hotfix brancheshotfix/
    Version tag prefix (optional)empty (e.g. v)
  3. Click Initialize (or Save, when configuring). The bar shows "Configuring Gitflow…" and the notice "Gitflow configured".

What Versora does in git

bash
# creates develop if it doesn't exist yet: from origin/develop, if there is one; otherwise, from main
git branch develop origin/develop
git config --local gitflow.branch.master main
git config --local gitflow.branch.develop develop
git config --local gitflow.prefix.feature feature/
git config --local gitflow.prefix.release release/
git config --local gitflow.prefix.hotfix hotfix/
git config --local gitflow.prefix.versiontag v

How to undo

Initialization doesn't go into Ctrl+Z. To change the values, use Configure Gitflow. The created develop branch can be deleted like any other.

Caveats and messages

  • "Enter different branches for production and development."
  • "Branch "main" doesn't exist. Create the first commit before starting Gitflow."

Start a feature, release or hotfix

Where to find it

  • GITFLOW section: Start on the type's row ("Start feature (feature/…)").
  • Palette (Ctrl+P): "Gitflow: start Feature…", "Gitflow: start Release…", "Gitflow: start Hotfix…". Without Gitflow, they're unavailable with the reason "Gitflow isn't set up in this repository".

Step by step

  1. Click Start on the Feature row. The window says: "Creates a feature/… branch from develop and checks it out."
  2. Type the Feature name (e.g. login-social). Spaces become hyphens.
    • For release and hotfix, the field is Version (e.g. 1.4.0) and comes already suggested from the commits since the last version tag: the release follows the automatic calculation of New version; the hotfix bumps the patch.
  3. Click Start. The bar shows "Starting feature/login-social…".

What Versora does in git

bash
git checkout -b feature/login-social develop    # release: from develop
git checkout -b hotfix/1.3.1 main               # hotfix: from the production branch

How to undo

Ctrl+Z undoes it ("Start feature/login-social"): the created branch goes away and the checkout goes back to the previous branch.

Where to find it

  • GITFLOW section: Finish on the branch's row ("Finish feature/login-social").
  • Menu: right-click the branch › Gitflow: finish feature… (the type changes). With a workflow chosen, this item gives way to the workflow's Finish.
  • Palette (Ctrl+P): "Gitflow: finish feature/login-social…" (for the current branch).

Step by step

  1. Open Finish feature. The window describes the steps:
    • feature: "Merges feature/login-social into develop. Nothing is pushed to the remote automatically.";
    • release and hotfix: "Merges release/1.4.0 into main, creates tag v1.4.0 and merges back into develop. Nothing is pushed to the remote automatically."
  2. Leave Delete local branch feature/login-social when done checked (default) or uncheck it to keep the branch.
  3. On a checked-out release or hotfix, check, if you want, First, update the version and CHANGELOG (New version…). See Version and changelog before finishing.
  4. Click Finish. The bar shows "Finishing feature/login-social…" and the notice sums it up, for example "release/1.4.0: merged into main, tag v1.4.0 created, merged into develop, branch deleted".
  5. Push main, develop and the tag whenever you want: nothing is pushed automatically.

What Versora does in git

bash
# feature
git checkout develop --
git merge --no-ff --no-edit feature/login-social
git branch -d feature/login-social

# release and hotfix
git checkout main --
git merge --no-ff --no-edit release/1.4.0
git tag -a v1.4.0 -m "release 1.4.0"     # only if the tag doesn't exist yet
git checkout develop --
git merge --no-ff --no-edit release/1.4.0
git branch -d release/1.4.0

The tag is the version tag prefix plus the branch name without the type prefix.

How to undo

Ctrl+Z undoes the whole finish ("Finish release/1.4.0"): the merges, the tag and the branch deletion.

On a conflict

The operation stops at the merge that conflicted. Resolve it in the conflict editor, conclude the merge and finish again: the steps already done are skipped.

Caveats and messages

  • ""feature-login" isn't a feature branch (feature/…).": the name doesn't start with the type's prefix.
  • "Gitflow hasn't been initialized in this repository yet.": initialize it first.

Version and changelog before finishing

On a checked-out release or hotfix, the First, update the version and CHANGELOG (New version…) box opens New version in Gitflow mode, before the merge:

  • the title is "Version and changelog before finishing";
  • the version already comes from the branch name (release/1.4.0 → 1.4.0);
  • tag creation is disabled, with the note "— Gitflow creates the tag when finishing the release" (on a hotfix, "— Gitflow creates the tag when finishing the hotfix"), and there's no push;
  • the button is Record 1.4.0 and finish: Versora creates the version and changelog commit on the release branch and then finishes.

If you close New version without confirming, the finish is canceled: "Finish canceled: the version wasn't recorded."

Gitflow in the other tools

With Gitflow configured, other parts of Versora use develop as the reference:

  • Branch cleanup and the Branches review compare with develop on the automatic base, and a release/* or hotfix/* that hasn't reached main yet is never offered for cleanup;
  • the Fork point uses develop as the origin;
  • conflict prediction compares with develop on the automatic target;
  • the issues' "Start work" uses Gitflow's feature prefix.

Gitflow has no page of its own in Preferences: everything lives in the gitflow.* keys of the repository's local config. The workflow's Gitflow preset uses the Preferences › Workflow page.

See also