Gitflow is a branching model that organizes feature development, releases, and hotfixes into dedicated branches, providing a structured approach to managing complex software projects with reliable releases based on semantic versioning.
The gitflow-cli automates this release workflow process, saving time and reducing the risk of errors. It maintains a clean and consistent Git graph, contributing to overall project stability.
From within the project directory the gitflow-cli can be built, run and installed.
-
Clone the repository:
git clone https://github.com/mercedes-benz/gitflow-cli.git cd gitflow-cli
-
Install the application:
To install and run the application, use the following commands:
go install gitflow-cli --help
Note: Make sure you have Go installed and that the
go/bin
directory is part of your PATH.
Before starting to use gitflow-cli, navigate to the Git repository you want to operate on. Make sure the repository meets all preconditions.
To initiate a new release/x.y.z
branch from develop
, use the following command:
gitflow-cli release start
You can now use the release/x.y.z
branch for bug fixing, creating the release changelog,
or even deploying your product on a staging environment. Once the release is ready, finish it with:
gitflow-cli release finish
To initiate a new hotfix/x.y.z
branch from main
, use the following command:
gitflow-cli hotfix start
Check out the hotfix/x.y.z
branch, create a quick patch, and push your changes. Then, finish the hotfix with:
gitflow-cli hotfix finish
To use gitflow-cli, ensure your project meets the basic structural requirements, particularly around Git branches and version management.
Your repository must define a dedicated production and development branches (e.g. main and develop). These can be customized as needed.
Each project type may store version information in a different location. The gitflow-cli detects your project's context and automatically delegates tasks to the appropriate plugin based on the presence of specific files.
Plugin | Description | Required File | Status |
---|---|---|---|
standard | Plugin for projects without a predefined technology stack. | version.txt |
|
maven | Plugin for maven projects. | pom.xml |
|
npm | Plugin for npm projects. | package.json |
You have the option to provide a configuration file to gitflow-cli.
This configuration file will be automatically located at HOME/.gitflow-cli.yaml
and has the following structure:
core:
production: main | custom-name # production branch name
development: develop | custom-name # development branch name
release: release | custom-name # release branch prefix
hotfix: hotfix | custom-name # hotfix branch prefix
undo: true | false # rollback local changes in case of an error, default = false
logging: stderr | stdout | cmdline | output | off # diagnostic logging for the Gitflow workflow, default = stdout | cmdline | output
You can also specify a custom configuration file using the top-level flag --config file-path
.
We welcome any contributions. If you want to contribute to this project, please read the contributing guide.
To contribute to gitflow-cli, we suggest setting up the Git hook below to comply with our contribution guidelines.
cp .githooks/prepare-commit-msg .git/hooks/
chmod +x .git/hooks/prepare-commit-msg
Please read our Code of Conduct as it is our base for interaction.
This project is licensed under the MIT LICENSE.
Please visit https://www.mercedes-benz-techinnovation.com/en/imprint/ for information on the provider.
Notice: Before you use the program in productive use, please take all necessary precautions, e.g. testing and verifying the program with regard to your specific use. The source code has been tested solely for our own use cases, which might differ from yours.