git-merged-branches` is a command-line utility to view branches merged into a selected base branch (e.g., master or main).
- CLI usage
- customizable via
package.json
Install globally to use git-merged-branches
or the shorter version gmb
:
npm install --global git-merged-branches
Or use it without installation via npx:
npx git-merged-branches
By default, the command shows merged branches into the base branch (master or main). If neither exists, it will notify you.
Example output:
$ git-merged-branches
Branches merged into 'master':
feature/add-new-feature
bugfix/fix-crash-on-start
hotfix/urgent-fix
You can configure the utility in your package.json
under git-merged-branches
. This allows you to set:
- issueUrlFormat: Base URL for your issue tracker (must be a valid URL).
- issueUrlPrefix: Array of prefixes for issue identifiers in branch names.
Example configuration:
"git-merged-branches": {
"issueUrlFormat": "https://your-jira-instance.net/browse/{{prefix}}{{id}}",
"issueUrlPrefix": ["TOKEN-", "PROJECT-"]
}
With this setup, git-merged-branches
will generate links for branches with such tokens in their name:
$ git-merged-branches
Branches merged into 'master':
TOKEN-800_new-feature <https://your-jira-instance.net/browse/TOKEN-800>
fix/TOKEN-123_some-fix <https://your-jira-instance.net/browse/TOKEN-123>
fix/EXTERNAL-391
hotfix
If the configuration is invalid, warnings will be shown and the utility will skip formatting URLs.
To contribute or test locally:
-
Clone the repository:
git clone https://github.com/VChet/git-merged-branches.git cd git-merged-branches
-
Install dependencies:
npm install
-
Build the project:
npm run build
-
Link it locally for testing:
npm link
Now you can run git-merged-branches
on your local machine.
If you have any ideas, bug reports, or feature requests, feel free to contribute or report issues.