Skip to content

Add support for git flow using the git-flow-next tool#5288

Open
hmaddocks wants to merge 4 commits into
jesseduffield:masterfrom
hmaddocks:enable-git-flow-next-as-the-git-flow-tool
Open

Add support for git flow using the git-flow-next tool#5288
hmaddocks wants to merge 4 commits into
jesseduffield:masterfrom
hmaddocks:enable-git-flow-next-as-the-git-flow-tool

Conversation

@hmaddocks
Copy link
Copy Markdown

This change enables Lazygit git-flow integration to work with git-flow-next. The "official" git-flow has been deprecated and replaced by git-flow-next. got-flow-next has the same tool and most of the functionality is compatible but the git config is different so Lazygit doesn't recognise it.

  • Support gitflow.branch..prefix (git-flow-next) in addition to gitflow.prefix. (legacy)
  • Refactor FinishCmdObj to use a prefix map lookup to find the branch type

@conifercone
Copy link
Copy Markdown

Is there any progress on this PR?

@hmaddocks
Copy link
Copy Markdown
Author

Is there any progress on this PR?

Just this morning I was wondering the same thing.

Is there anything I can do to move this forward?

@conifercone
Copy link
Copy Markdown

Is there any progress on this PR?

Just this morning I was wondering the same thing.

Is there anything I can do to move this forward?

I really need this feature, and I really hope this PR can be merged.

@streicherishere
Copy link
Copy Markdown

streicherishere commented Mar 20, 2026

I need this feature too. Please merge this PR.

@ajay126z
Copy link
Copy Markdown

ajay126z commented May 2, 2026

I also need this feature, so please merge the PR.

hmaddocks and others added 4 commits May 10, 2026 12:29
Lift the inline parsing in FinishCmdObj into parseGitFlowPrefixMap on
ConfigCommands. The caller now does a direct map lookup against the
parsed prefix → branchType map instead of iterating the raw config
output and suffix-matching. This is preparation for adding git-flow-next
support, which needs to merge a second config schema into the same map.

One incidental change: a branch name without a slash now returns
NotAGitFlowBranch immediately, rather than falling through the
line loop with an empty suffix. Previously a configured
gitflow.prefix.X whose value happened to equal the entire branch
name could match — never a useful outcome.
git-flow-next (https://github.com/gittower/git-flow-next) uses a
different config schema than legacy git-flow:
gitflow.branch.<type>.prefix instead of gitflow.prefix.<type>.
Recognize both schemas in GetGitFlowPrefixMap by querying each and
merging into a single prefix → branchType map. GitFlowEnabled now
consults the merged map so a next-only setup counts as enabled.

When both schemas configure the same prefix, the legacy entry wins.
In normal usage both schemas agree, so the rule mainly matters as a
deterministic tie-breaker.
Make the "legacy wins" scenarios actually distinguish legacy from next.
Both sides used the same branchType ("feature"), so the assertion would
pass equally well under a "next wins" rule — the test didn't pin the
conflict-resolution behavior it was named for. Give legacy and next
distinct types so a regression in the merge order would be caught.
Both getGitFlowPrefixes and getGitFlowNextPrefixes are only called by
GetGitFlowPrefixMap in the same file, so they don't need package-external
visibility. The merged map returned by GetGitFlowPrefixMap is the only
abstraction the rest of the package needs.
@stefanhaller stefanhaller force-pushed the enable-git-flow-next-as-the-git-flow-tool branch from 8c3272c to 405d883 Compare May 10, 2026 11:48
@stefanhaller
Copy link
Copy Markdown
Collaborator

Sorry for the delay.

I'm not a git-flow user, so I can't test this myself; and I'm also unfamiliar with our code around git-flow, so I couldn't meaningfully review it. I asked Claude to do a code review, and it came up with two fixups; also, it recommended to split the commit in two (prep refactor and actual change), so I had it do that too (with more elaborate commit messages). It kept you as the author of both commits, let me know if you object to that; we could also put me in as the author and add you as Co-authored-by; just let me know what you prefer.

Does anybody here want to test it again before I merge?

@stefanhaller stefanhaller added the enhancement New feature or request label May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants