Skip to content

CLI tool to list all Git branches merged into a base branch with issue link formatting

License

Notifications You must be signed in to change notification settings

VChet/git-merged-branches

Repository files navigation

git-merged-branches

npm version build

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

Installation

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

Usage

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

Configuration

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.

Development

To contribute or test locally:

  1. Clone the repository:

    git clone https://github.com/VChet/git-merged-branches.git
    cd git-merged-branches
  2. Install dependencies:

    npm install
  3. Build the project:

    npm run build
  4. Link it locally for testing:

    npm link

Now you can run git-merged-branches on your local machine.

Contributing

If you have any ideas, bug reports, or feature requests, feel free to contribute or report issues.

About

CLI tool to list all Git branches merged into a base branch with issue link formatting

Topics

Resources

License

Stars

Watchers

Forks