Skip to content

Reference: git flow bugfix

Konstantin edited this page Dec 15, 2025 · 5 revisions

Reference: git flow bugfix

git flow bugfix [list] [-v] - Lists existing bugfix branches

Description

Lists all the existing bugfix branches in the local repository.

Synopsis

git flow bugfix [list] [-h] [-v]

Options

-h,--[no]help show this help

-v,--[no]verbose verbose (more) output


git flow bugfix start - Start a new bugfix branch

Description

Start new bugfix <name>, optionally basing it on <base> instead of <develop>

Synopsis

git flow bugfix start [-h] [-F] <name> [<base>]

Options

-h,--[no]help show this help

--showcommands
Show git commands while executing them

-F,--[no]fetch
fetch from origin before performing local operation


git flow bugfix finish - Finish a existing bugfix

Description

Finish bugfix <name>

Synopsis

git flow bugfix finish [-h] [-F] [-r] [-p] [-k] [-D] [-S] [--no-ff] <name|nameprefix>

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them

-F,--[no]fetch
fetch from origin before performing finish

-r,--[no]rebase
rebase before merging

-p,--[no]preserve-merges
preserve merges while rebasing

-k,--[no]keep
keep branch after performing finish

--[no]keepremote
keep the remote branch

--[no]keeplocal
keep the local branch

-D,--[no]force_delete
force delete bugfix branch after finish

-S,--[no]squash
squash bugfix during merge

--no-ff
never fast-forward during the merge

GitHub/GitLab Merge Detection (LBEM Edition)

If you merged your bugfix branch on GitHub/GitLab (e.g., via the web UI after git flow bugfix propose), finish will detect this automatically:

  • If the remote branch is deleted but changes are already merged into the base branch
  • The command will simply clean up the local branch
  • No merge is performed (since the changes are already in the base branch)

This allows you to use propose to create a PR, merge it on GitHub/GitLab, and then run finish to clean up your local branch.


git flow bugfix publish - Publish bugfix branch

Description

Publish bugfix branch <name> on $ORIGIN

Synopsis

git flow bugfix publish [-h] <name>

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them


git flow bugfix track - Track a bugfix branch

Description

Start tracking bugfix <name> that is shared on $ORIGIN

Synopsis

git flow bugfix track [-h] <name>

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them


git flow bugfix diff - Show all changes of the bugfix branch

Description

Show all changes in <name> that are not in <develop>

Synopsis

git flow bugfix diff [-h] [<name|nameprefix>]

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them


git flow bugfix rebase - Perform a rebase

Description

Rebase <name> on <base_branch>

Synopsis

git flow bugfix rebase [-h] [-i] [-p] [<name|nameprefix>]

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them

-i,--[no]interactive
do an interactive rebase

-p, --[no]preserve-merges
preserve merges


git flow bugfix checkout - Checkout the bugfix branch

Description

Switch to bugfix branch <name>

Synopsis

git flow bugfix checkout [-h] [<name|nameprefix>]

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them


git flow bugfix pull - Pull bugfix branch

Description

Pull bugfix <name> from <remote>

Synopsis

git flow bugfix pull [-h] <remote> [<name>]

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them


git flow bugfix delete - Delete a bugfix branch

Description

Deletes a given bugfix branch

Synopsis

git flow bugfix delete [-h] [-f] [-r] <name>

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them

-f,--[no]force
force deletion

-r,--[no]remote
delete remote branch


git flow bugfix rename - Rename a bugfix branch

Description

Rename branch <name> to <new_name>

Synopsis

git flow bugfix rename [-h] <new_name> [<name>]

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them


git flow bugfix sync - Sync bugfix branch (LBEM Edition)

Description

Synchronize bugfix branch <name> with the base branch. This command fetches updates from origin, updates the base branch (develop), and rebases or merges your bugfix branch on top of it. Optionally prunes stale branches. Inspired by git-town sync.

Synopsis

git flow bugfix sync [-h] [--prune] [<name|nameprefix>]

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them

--prune
After syncing, prune local branches whose tracking remote branches no longer exist (e.g., branches merged via GitHub PR)

Behavior

  1. Stashes any uncommitted changes
  2. Fetches updates from origin (with --prune to clean up deleted remote refs)
  3. Updates the base branch (e.g., develop) with remote changes
  4. Rebases or merges your bugfix branch (based on syncstrategy config)
  5. Optionally pushes your branch to origin
  6. If --prune is specified, prompts to delete stale local branches (branches whose remote tracking branch is gone)
  7. Restores stashed changes

Prune Safety

When using --prune, the command will:

  • Skip branches that have unpushed commits (local changes not on remote)
  • Prompt for confirmation before deleting each stale branch
  • Show which branches are being skipped due to local changes

Configuration

  • gitflow.syncstrategy - Set to rebase (default) or merge
  • gitflow.sync.prune - Set to true to enable prune by default

git flow bugfix propose - Propose bugfix as PR (LBEM Edition)

Alias: git flow bugfix pr

Description

Publish bugfix branch and create a pull/merge request. Uses GitHub CLI (gh) or GitLab CLI (glab) if available, otherwise opens the PR creation URL in your browser.

Synopsis

git flow bugfix propose [-h] [-d] [-a <user>] [-R <user>] [-l <label>] [<name|nameprefix>]
git flow bugfix pr [-h] [-d] [-a <user>] [-R <user>] [-l <label>] [<name|nameprefix>]

Options

-h,--[no]help
show this help

--showcommands
Show git commands while executing them

-d,--[no]draft
Create the pull request as a draft

-a,--assignee <user>
Assign users to the pull request (comma-separated for multiple)

-R,--reviewer <user>
Request reviews from users (comma-separated for multiple)

-l,--label <label>
Add labels to the pull request (comma-separated for multiple)

Behavior

  1. Publishes the bugfix branch to origin (if not already published)
  2. Detects the forge type (GitHub, GitLab, Bitbucket)
  3. Creates a PR using CLI tools if available:
    • GitHub: uses gh pr create
    • GitLab: uses glab mr create
  4. Falls back to opening PR creation URL in browser if no CLI is available
  5. For Bitbucket, always opens the browser URL

Configuration

  • gitflow.proposeopen - Set to true (default) or false to control browser auto-open
  • gitflow.finishmode - Set to propose to use propose instead of finish by default
  • gitflow.bugfix.propose.draft - Set to true to create draft PRs by default
  • gitflow.bugfix.propose.assignee - Default assignee(s) for PRs
  • gitflow.bugfix.propose.reviewer - Default reviewer(s) for PRs
  • gitflow.bugfix.propose.labels - Default label(s) for PRs
  • gitflow.bugfix.propose.autolabel - Set to true to auto-add "bugfix" label

Clone this wiki locally