Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/trigger-homebrew.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Trigger Homebrew Formula Update

on:
push:
tags:
- 'v*'

jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Get latest completion version
id: completion_version
run: |
COMP_VERSION=$(curl -s https://api.github.com/repos/LBEM-CH/gitflow-lbem-completion/tags | jq -r '.[0].name')
echo "version=${COMP_VERSION}" >> $GITHUB_OUTPUT
echo "Latest completion version: ${COMP_VERSION}"

- name: Trigger Homebrew formula update
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.HOMEBREW_DISPATCH_TOKEN }}
repository: LBEM-CH/homebrew-gitflow-lbem
event-type: main-release
client-payload: '{"version": "${{ github.ref_name }}", "completion_version": "${{ steps.completion_version.outputs.version }}"}'
131 changes: 110 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
# git-flow (CJS Edition)
# git-flow (LBEM Edition)

A collection of Git extensions to provide high-level repository operations
for Vincent Driessen's [branching model](http://nvie.com/git-model "original
blog post"). This fork adds functionality not added to the original branch.
blog post").

## About LBEM Edition

This is a fork of [gitflow-cjs](https://github.com/CJ-Systems/gitflow-cjs) that adds workflow enhancements inspired by [git-town](https://www.git-town.com/). LBEM Edition stays close to the CJS version to easily pull upstream bugfixes while adding the following features:

### Additional Commands

- **`git flow feature sync`** / **`git flow bugfix sync`** - Sync your branch with the base branch (like `git-town sync`). Handles uncommitted changes automatically, supports rebase or merge strategy.
- **`git flow feature propose`** / **`git flow bugfix propose`** - Create a pull request for your branch using `gh` CLI (falls back to opening browser URL).
- **`git flow config export`** - Export gitflow settings to a `.gitflow` file for team sharing.

### Configuration Enhancements

- **`.gitflow` file support** - Store gitflow configuration in a shareable file. When a developer clones a repo with a `.gitflow` file and runs `git flow init`, settings are automatically imported.
- **Finish mode** - Configure how `finish` behaves: `classic` (traditional merge), `propose` (create PR), or `ask` (prompt each time). Set via `git flow config set finishmode <mode>`.
- **Sync strategy** - Choose `rebase` (default) or `merge` for sync operations. Set via `git flow config set syncstrategy <strategy>`.

### macOS Compatibility

LBEM Edition includes fixes for macOS compatibility with BSD getopt. Install GNU getopt via Homebrew and set:
```bash
export FLAGS_GETOPT_CMD="/usr/local/opt/gnu-getopt/bin/getopt"
```

## Upstream Projects

This project is based on and grateful to:

- **[gitflow-cjs](https://github.com/CJ-Systems/gitflow-cjs)** - The CJS Edition that continues maintenance after AVH was archived
- **[gitflow-avh](https://github.com/petervanderdoes/gitflow-avh)** - The AVH Edition that extended the original gitflow
- **[nvie/gitflow](https://github.com/nvie/gitflow)** - The original gitflow implementation by Vincent Driessen

## Why another git-flow fork?

## Why another git-flow fork
The last commit to [gitflow-avh](https://github.com/petervanderdoes/gitflow-avh)
was on May 23, 2019 and has been archived on Jun 19, 2023. Since 2019 there have
been a number of issues opened that have not be resolved. This fork will address
those outstanding issues and open PR's along with continuing to maintain the
git-flow branching model.
been a number of issues opened that have not be resolved. [gitflow-cjs](https://github.com/CJ-Systems/gitflow-cjs) continues maintenance but we needed additional workflow features for our team.

## Getting started

Expand All @@ -30,14 +60,14 @@ A quick cheatsheet was made by Daniel Kummer:

## Installing git-flow

See the Wiki for up-to-date [Installation Instructions](https://github.com/CJ-Systems/gitflow-cjs/wiki/Installation).
See the Wiki for up-to-date [Installation Instructions](https://github.com/LBEM-CH/gitflow-lbem/wiki/Installation).


## Integration with your shell

For those who use the [Bash](https://www.gnu.org/software/bash/) or [ZSH](https://www.zsh.org/)
shell, you can use my [fork of git-flow-completion](https://github.com/petervanderdoes/git-flow-completion)
which includes several additions for git-flow (AVH Edition), or you can use the
shell, you can use our [fork of git-flow-completion](https://github.com/LBEM-CH/gitflow-lbem-completion)
which includes several additions for git-flow (CJS & AVH Edition), or you can use the
original [git-flow-completion](https://github.com/bobthecow/git-flow-completion)
project by [bobthecow](https://github.com/bobthecow). Both offer tab-completion
for git-flow subcommands and branch names with my fork including tab-completion
Expand All @@ -46,12 +76,13 @@ for the commands not found in the original git-flow.

## FAQ

* See the [FAQ](https://github.com/CJ-Systems/gitflow-cjs/wiki/FAQ) section
* See the [FAQ](https://github.com/LBEM-CH/gitflow-lbem/wiki/FAQ) section
of the project Wiki.
* Version Numbering Scheme.
Starting with version 1.0, the project uses the following scheme:
\<MAJOR\>.\<MINOR\>.\<REVISION\>\
\<MAJOR\>.\<MINOR\>.\<REVISION\>-lbem.\<LBEM_REVISION\>
* CJS is the acronym of "CJ Systems"
* LBEM is the acronym of "Laboratory of Biological Electron Microscopy"

## Please help out

Expand All @@ -72,21 +103,32 @@ using the complete version number.

## Contributing

If submiting a new pull request addressing an already open issue with gitflow-avh please link the relevant issue in the description. For any new issues please see below
### Where to contribute?

- **LBEM Edition features** (sync, propose, config export, .gitflow file support, finish mode): Please contribute to [gitflow-lbem](https://github.com/LBEM-CH/gitflow-lbem)
- **General gitflow bugs and features**: Please contribute to the upstream [gitflow-cjs](https://github.com/CJ-Systems/gitflow-cjs) repository. We regularly pull in upstream changes.

### Quick Start for LBEM Edition contributions

### Quick Start for new issues
* Fork and clone [gitflow-lbem](https://github.com/LBEM-CH/gitflow-lbem)
* Create a feature branch based off develop: `git flow feature start my-feature`
* Commit your changes to the local branch
* Push your feature branch: `git flow feature publish`
* Create a pull request against the `develop` branch

* Please fork and clone a local copy of [gitflow-cjs](https://github.com/CJ-Systems/gitflow-cjs).
* Create a seperate issue branch based off develop.
* Commit commit you fix to the local branch.
* Please update your local copy with the latest devlop branch of [gitflow-cjs](https://github.com/CJ-Systems/gitflow-cjs)
* Rebase develop onto your local branch.
* Push your fix to your fork.
* When ready to submit a pull request.
### Quick Start for general gitflow issues

* Please fork and clone a local copy of [gitflow-cjs](https://github.com/CJ-Systems/gitflow-cjs)
* Create a separate issue branch based off develop
* Commit your fix to the local branch
* Please update your local copy with the latest develop branch of [gitflow-cjs](https://github.com/CJ-Systems/gitflow-cjs)
* Rebase develop onto your local branch
* Push your fix to your fork
* Submit a pull request

### How to submit a pull request

For any new PRs releated to gitflow-cjs you can use on of the keywords from [Linking a pull request to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) to automatically close the releated issue.
For any new PRs related to gitflow-cjs you can use one of the keywords from [Linking a pull request to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) to automatically close the related issue.

## License terms

Expand Down Expand Up @@ -217,6 +259,53 @@ and eventually finish it:
git flow hotfix finish
```

### Sync feature/bugfix branches (LBEM Edition)

To synchronize your feature branch with the latest changes from the develop branch, use:
```shell
git flow feature sync [<name>]
```

This command (inspired by [git-town sync](https://www.git-town.com/commands/sync.html)):
- Stashes any uncommitted changes
- Fetches from the remote
- Rebases (or merges, depending on config) your branch onto the latest develop
- Restores your stashed changes

You can configure the sync strategy:
```shell
git flow config set syncstrategy rebase # default
git flow config set syncstrategy merge
```

### Create pull requests (LBEM Edition)

Instead of merging locally with `finish`, you can create a pull request:
```shell
git flow feature propose [<name>]
```

This will:
- Push your branch to the remote (if not already pushed)
- Create a pull request using `gh` CLI (if available)
- Fall back to opening the PR URL in your browser

You can also configure `finish` to always create a PR instead of merging:
```shell
git flow config set finishmode propose # always create PR
git flow config set finishmode classic # traditional merge (default)
git flow config set finishmode ask # prompt each time
```

### Export/Import configuration (LBEM Edition)

To share gitflow configuration with your team, export settings to a `.gitflow` file:
```shell
git flow config export
```

This creates a `.gitflow` file in your repository root that can be committed. When another developer clones the repo and runs `git flow init`, the settings are automatically imported.


### Using Hooks and Filters

Expand Down
25 changes: 23 additions & 2 deletions git-flow
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# http://github.com/CJ-Systems/gitflow-cjs
#
# Authors:
# Copyright 2025 LBEM. All rights reserved.
# Copyright 2003 CJ Systems. All rights reserved.
# Copyright 2012-2019 Peter van der Does. All rights reserved.
#
Expand Down Expand Up @@ -102,6 +103,7 @@ usage() {
echo " version Shows version information."
echo " config Manage your git-flow configuration."
echo " log Show log deviating from base branch."
echo " sync Sync current branch with its base (shortcut)."
echo
echo "Try 'git flow <subcommand> help' for details."
}
Expand All @@ -120,15 +122,34 @@ main() {
. "$GITFLOW_DIR/gitflow-common"

# allow user to request git action logging
DEFINE_boolean 'showcommands' false 'Show actions taken (git commands)'
DEFINE_boolean 'showcommands' false 'Show actions taken (git commands)' s
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove conflicting -s alias from global showcommands

Defining top-level showcommands with short flag -s collides with subcommands that already use -s (for example release finish --sign and hotfix finish --sign). In shFlags, this duplicate short name causes the later flag definition to be skipped, which leads to runtime errors like [: -eq: unexpected operator when those commands call flag sign, and can silently break sign-related behavior.

Useful? React with 👍 / 👎.

# but if the user prefers that the logging is always on,
# use the environmental variables.
gitflow_override_flag_boolean 'showcommands' 'showcommands'

# Sanity checks
SUBCOMMAND="$1"; shift
if [ "${SUBCOMMAND}" = "finish" ] || [ "${SUBCOMMAND}" = "delete" ] || [ "${SUBCOMMAND}" = "publish" ] || [ "${SUBCOMMAND}" = "rebase" ]; then
if [ "${SUBCOMMAND}" = "finish" ] || [ "${SUBCOMMAND}" = "delete" ] || [ "${SUBCOMMAND}" = "publish" ] || [ "${SUBCOMMAND}" = "rebase" ] || [ "${SUBCOMMAND}" = "sync" ]; then
_current_branch=$(git_current_branch)

# Handle sync on develop/main branches specially
if [ "${SUBCOMMAND}" = "sync" ]; then
_develop_branch=$(git config --get gitflow.branch.develop 2>/dev/null)
_master_branch=$(git config --get gitflow.branch.master 2>/dev/null)
if [ "${_current_branch}" = "${_develop_branch}" ] || [ "${_current_branch}" = "${_master_branch}" ]; then
# For develop/main, just do a pull
echo "Syncing branch '${_current_branch}'..."
git fetch -q origin || { echo "Could not fetch from origin."; exit 1; }
if git rev-parse --verify "origin/${_current_branch}" >/dev/null 2>&1; then
git merge --ff-only "origin/${_current_branch}" || { echo "Could not fast-forward '${_current_branch}'. You may need to merge manually."; exit 1; }
Comment on lines +142 to +144
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use configured origin for develop/master sync path

The new top-level sync fast-path hardcodes origin instead of using the configured git-flow remote (gitflow.origin / $ORIGIN). In repositories that intentionally use a different remote name (e.g., upstream), git flow sync on develop/master fails immediately with fetch errors even though the repo is correctly configured.

Useful? React with 👍 / 👎.

echo "Branch '${_current_branch}' is now up to date with 'origin/${_current_branch}'."
else
echo "No remote tracking branch for '${_current_branch}'."
fi
exit 0
fi
fi

if gitflow_is_prefixed_branch "${_current_branch}"; then
if startswith "${_current_branch}" $(git config --get gitflow.prefix.feature); then
SUBACTION="${SUBCOMMAND}"
Expand Down
Loading