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.
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
Since each project type has a different structure (e.g. variations in where the version number is stored, etc.), the gitflow-cli automatically detects the project context and delegates command execution to the appropriate plugins.
Currently, the following plugins are available:
-
maven
- Workflow for maven projects
- Requires a
pom.xml
file in the root directory
-
standard
- Workflow for projects without a designated technology
- Requires a
version.txt
file in the root directory - Currently not implemented, but can be used as a template for additional plugins
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.