@lizee/gitflub
v1.0.9
Published
CLI used to merge the gitflow functionalities with the github functionalities
Downloads
5
Keywords
Readme
gitflub
gitflub is a CLI used to merge the gitflow workflow with the github functionalities. Its main purpose is to allow the creation of Pull Requests (PR) when we finish a feature, a hotfix or a bugfix. We have some specifications at Lizee that may interfere with a normal git flow process. You can read a more general documentation about our git workflow and our deployment process here (only for Lizee employees) to help you comprehend everything.
Prerequisites
Yarn global
yarn config set prefix ~/.yarn
Add the install location to your PATH, add the following lines to your .zshrc
file (or .bashrc
) :
export PATH="$(yarn global bin):$PATH"
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
And restart your terminal.
GitHub CLI
You need to install the GitHub CLI to create the Pull Requests from the command line. You will also need to auth yourself on the GitHub CLI (you can check the documentation or this will be explained if you try to create a PR).
Installation
You can install gitflub with npm or yarn :
yarn global add @lizee/gitflub
npm install -g @lizee/gitflub
gitflub init
This command is used to initialize a repo.
gitflub init [-h] [-d]
- The -h option is used to display help for the command
- The -d option is used to set the default names for the git flow branches
gitflub feature
gitflub feature start
This command is used to create a new feature.
gitflub feature start <name> [<base>]
- The name argument is mandatory, it is the name of the feature, that will be prefixed by the feature prefix set during the initialization.
- The base argument is optional, it is the branch that will be used to start the feature from (default is develop).
gitflub feature publish
This command is used to push the branch on the remote repo.
gitflub feature publish [<name>]
- The name argument is optional, it is the name of the feature, that will be prefixed by the feature prefix set during the initialization. If omitted, the current branch will be published.
gitflub feature finish
This command is used to push the branch on the remote repo, and create a Pull Request thanks to the GitHub CLI (you need to be connected to the CLI in order to do that).
gitflub feature finish [<name>] [<base>] [--no-pr]
- The --no-pr option is used to prevent the creation of a PR and just merge locally (like git flow usually does).
- The name argument is optional, if omitted the current branch will be merged.
- The base argument is optional, it is the branch that will be used to merge the feature to (default is develop).
gitflub feature list
This command is used to list the feature branches currently available on your local repo.
gitflub feature list
gitflub bugfix
The gitflub bugfix command works exactly like the feature command, except you replace feature by bugfix. It is used to fix non-urgent bugs because these branches will be merged on develop like features.
gitflub bugfix start <name> [<base>]
gitflub bugfix publish [<name>]
gitflub bugfix finish [<name>] [<base>] [--no-pr]
gitflub bugfix list
gitflub hotfix
gitflub hotfix start
This command is used to create a new hotfix.
gitflub hotfix start <version> [<base>]
- The version argument is mandatory, it is the version of the hotfix, that will be prefixed by the hotfix prefix set during the initialization.
- The base argument is optional, it is the branch that will be used to start the hotfix from (default is master).
gitflub hotfix publish
This command is used to push the branch on the remote repo.
gitflub hotfix publish [<version>]
- The version argument is optional, it is the version of the hotfix, that will be prefixed by the hotfix prefix set during the initialization. If omitted, the current branch will be published.
gitflub hotfix finish
This command is used to push the branch on the remote repo, and create a Pull Request thanks to the GitHub CLI (you need to be connected to the CLI in order to do that).
gitflub hotfix finish [<version>] [<base>] [--no-pr]
- The --no-pr option is used to prevent the creation of a PR and just merge locally (like git flow usually does).
- The version argument is optional, if omitted the current branch will be merged.
- The base argument is optional, it is the branch that will be used to merge the hotfix to (default is master).
For the RP team, this will create another PR : from the hotfix branch to the production branch (only if the production branch exists).
gitflub hotfix list
This command is used to list the hotfix branches currently available on your local repo.
gitflub hotfix list
gitflub release
gitflub release start
This command is used to create a new release.
gitflub release start <version> [<base>]
- The version argument is mandatory, it is the version of the release, that will be prefixed by the release prefix set during the initialization.
- The base argument is optional, it is the branch that will be used to start the release from (default is develop).
gitflub release publish
This command is used to push the branch on the remote repo.
gitflub release publish [<version>]
- The version argument is not mandatory, it is the version of the release, that will be prefixed by the release prefix set during the initialization. If omitted, the current branch will be published.
gitflub release finish
This command is used to merge the release to the master and the develop branches. It does not create PRs like the other commands (feature, hotfix, bugfix) !
gitflub release finish [<version>] [<base>] [--pr]
- The --pr option is used to ask explicitly the creation of a PR and not just merge locally (like git flow usually does).
- The version argument is optional, if omitted the current branch will be merged.
- The base argument is optional, it is the branch that will be used to merge the release to (default is develop).
For the RP team, they will handle the PR master -> production after because they need to test on preprod first (deployed when master is pushed).
gitflub release list
This command is used to list the release branches currently available on your local repo.
gitflub release list
Contribution
To help developing this CLI, you can download the code on Github and update it.
To test your changes, you can do yarn linkpkg
that will link the gitflub command with the current code, and then you can use gitflub
like you used to.
Once you are done, you can just do a yarn unlink
in the repository to cancel the link.