Utility used to automate your Git operations by implementing a custom branching model. Based on Peter van der Does' gitflow-avh repo.
- Run in an existing GIT repository (cloned with either SSH or HTTPs)
- Have all base branches created (at least locally).
gitflow init
command coming soon!
Here is the list of requirements needed:
- Bash 4 or higher.
- Here is an article on how to update Bash in MacOS. Skip the
Set Default Shell
section, that won't be needed.
- Here is an article on how to update Bash in MacOS. Skip the
- Allow redirection to
/dev/null
.- Sometimes this fails with permission denied in MacOS. If so, follow what's stated here.
- Have GNU enhanced getopt installed
- Have the following commands installed and available:
export
,echo
,eval
,unset
,exit
,cd
,pwd
,which
cat
,rm
,mkdir
,tty
,shasum
,head
,tee
uname
,dirname
,realpath
,readlink
sed
,cut
,grep
,tr
,wc
,awk
nano
git
curl
jq
(>= 1.6)
You can check if you have everything required to run this program by running
./check-requirements
The script will only check bash version, redirection to /dev/null
, GNU enhanced getopt installation and jq
installation. Every other commands is assumed to exist (they come installed in MacOS).
MacOS
To fulfill most of the above requirements in MacOS, you can run the installation script install
.
chmod +x install
./install
- You may need to re-run it until you get a message
All required commands/programs have been installed
.
- You may need to re-run it until you get a message
./check-requirements
- You should get a message
All required commands/programs are installed!
.
- You should get a message
- Complete the Setup
Windows
Not supported yet, you can try if it works. Some suggestions regarding the requirements:
- From stackoverflow --> install GNU getopt with Cygwin
gitflow is published under the FreeBSD License, see the LICENSE file. Although the FreeBSD License does not require you to share any modifications you make to the source code, you are encouraged and invited to contribute back your modifications to the community, preferably in a Github fork.
To setup gitflow
, you must do the following:
- Create a
.env
file as explained in the file.env-example
- Go to your terminal configuration file (eg: .bashrc, .zshrc) and add an alias pointing to the gitflow script
alias gitflow="/full/path/to/gitflow
You can customize gitflow
to adjust to your project's branching model. To do so, you must edit the file config.json
. The configurations available are the following:
base-branches
: array of strings with possible base branches to merge to from feature branches.feature-base
: base branch to create feature branches fromdefault-config
: NOT IMPLEMENTED YET, will be used to override default configurations for features. The current repo state is the default configuration.finish-steps
: array of objects with steps to follow when runningfeature finish
command. If error, steps are numbered from 1 to N. Each object must contain:base
: base branch to merge feature intoaux-branch
: boolean that states whether merging should be done from an auxiliar branchaux-branch-prefix
: prefix to use for the auxiliar branch. Only required ifaux-branch
is truewith-pr
: boolean that states if a PR should be created or if merging should be done during executionlabels
: array of strings with the labels to apply to the PR. Defaults to [].
Run gitflow with
gitflow <subcommand>
Available subcommands are
feature
Manage your feature branches.
Manage your feature branches. Available actions are
gitflow feature [help]
--> Display available actionsgitflow feature list
--> Lists existing local feature branchesgitflow feature start
--> Start new feature from basegitflow feature finish
--> Finish a feature (push, PRs, etc)gitflow feature publish
--> Publish feature to origingitflow feature track
--> Get feature branch from origingitflow feature diff
--> Show all changes in feature branch vs basegitflow feature checkout
--> Switch to feature branchgitflow feature rebase
--> Rebase feature branch on basegitflow feature pull
--> Pull feature branch from origingitflow feature delete
--> Delete feature branchgitflow feature rename
--> Rename feature branch