@faceit/branch
v2.0.1
Published
A script to bootstrap development tasks at FACEIT
Downloads
6
Readme
branch
This script helps creating git branches for development tasks, which comply to EFG's guidelines as described in the jira article "The way we develop at EFG".
It can be invoked from within the monorepo by running yarn branch [options]
or from any other repository by using the npx @faceit/branch [options]
command (node is required, but we plan on packaging this script as a standalone executable).
Command-line options
| Option | Description | | --------------------------- | ---------------------------------------------- | | -v, --version | Output the version number | | -t, --type <type> | Commit type | | -j, --ticket [ticket] | Jira Ticket number | | -a, --abstract <abstract> | Brief description of the activity | | -d, --dry-run | Only print the branch name without creating it | | -h, --help | Display help for command |
Example:
yarn branch -t feat -j TXP-1234 -a 'implement some very cool feature'
will result in the creation of a branch named feat_TXP-1234_implement-some-very-cool-feature
.
The script can also be run interactively with yarn branch
: the user will be asked to provide a commit type (by chosing from a list of options), a jira ticket number and a brief abstract of the task. The script will only prompt for unanswered questions, so if it is invoked with, e.g., the type argument (yarn branch -t fix
), it will skip the question about the commit type.
⚠ heads up
while the ticket number is not a mandatory argument, both the type and abstract are.
Moreover, the branch
script will automatically create an empty first commit on the branch (with message ci: first commit
) which is needed by the LinearB tool for development tracking purposes, and finally it will push the branch to a new upstream one.
squash
command
Once the work required on the branch has been completed, the script can be invoked with the squash
command, which accepts a single option:
| Option | Description |
| ------------------- | ------------------------------------------------------------------------- |
| -F, --no-force-push | Avoid running git push --force-with-lease
automatically after squashing |
The squash
command will:
- prompt for the name of the branch the current one stems from (since there is no easy way to determine this), which defaults to
master
- let the user pick one of the commit messages on the branch, or type a new one altogether
- proceed on squashing all the commits on the branch down to a single one, which will have the chosen message
- if the
-F
option was omitted, the script will proceed on force-pushing (with lease) the current branch