This repo includes a few pretty useful command-line utilities.
git review [branch]
- Creates a PR in githubgit prune-all [branch]
- Removes all branches which were removed in remote repogit take-issue [issueId]
- Creates a feature branch, or checkout existing branch. Note please, this command does nothing with issues in github or any other tool.
To install all of this scripts, simply run ./install
script.
You can configure git tools according to your needs. There are a few options available.
To change configuration you must create .git-tools
file like this one:
R2D2_BRANCH_NAME_TEMPLATE=feature/[issueId]
Available configuration properties:
R2D2_BRANCH_NAME_TEMPLATE
defines a template for branch names. Default value is$USER/[issueId]
.[issueId]
is replaced by passed argument.R2D2_REVIEW_TEMPLATE
defines a template for pull requests. If it exits thenR2D2_REVIEW_TEMPLATE_FILE
is ignored.R2D2_REVIEW_TEMPLATE_FILE
defines a file containing a template for PRs.R2D2_REVIEW_TEMPLATE_ISSUE_ID
defines a string from template which will be replaced by issue id.R2D2_REVIEW_TEMPLATE_GIT_LOG
defines a string from template which will be replaced bu git log.R2D2_VERSION_CONTROL
defines a VC service used. Default value isgithub
. The tool supports only GitHub.R2D2_ISSUE_TRACKER
issue tracker. Default value isgithub
. The tool supports only github for now.
This script is responsible to simplify workflow with feature branches
It creates a branch for an issue in the format [owner]/[issueId]
and pushes it to remote repo.
How does it work:
- If there is a local or remote branch with the same issue id it suggests to switch to one of the branches or create a new solution
- If the issue is a part of epic, then it will create a branch for epic (if it doesn't exist) and start an issue's branch from epic's branch
Useage:
take_issue [issueId]
Installation:
Put this file to some place then and chmod +x /path/to/script
If yoo want to have a git alias for it, you can run the following command:
set +H && git config --global alias.take-issue "!f(){ ~/path/to/script $1; }; f" && set -H
This script is responsible to simplify review request workflow It creates a PR by using data from git.
Useage:
review [baseBranch]
Installation:
Put this file to some place then and chmod +x /path/to/script
If yoo want to have a git alias for it, you can run the following command:
set +H && git config --global alias.review "!f(){ ~/path/to/script/review $1; }; f" && set -H
This script is responsible to clean up local repository. If you work hard, your local repository will contain hundreds of branches which does not exist in the remote repo.
Useage:
prune-all
Installation:
Put this file to some place then and chmod +x /path/to/script
If yoo want to have a git alias for it, you can run the following command:
set +H && git config --global alias.prune-all "!f(){ ~/path/to/script/prune-all $1; }; f" && set -H