Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

git-merged-branches

VChet162MIT0.2.5

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

git, cli, branch, issue-tracker

readme

git-merged-branches

npm version npm downloads build ask DeepWiki

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
3 branches merged into 'master':
bugfix/fix-crash-on-start
feature/add-new-feature
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
4 branches merged into 'master':
fix/EXTERNAL-391
fix/TOKEN-123_some-fix <https://your-jira-instance.net/browse/TOKEN-123>
hotfix
TOKEN-800_new-feature <https://your-jira-instance.net/browse/TOKEN-800>

If the configuration is invalid, warnings will be shown and the utility will skip formatting URLs.

Documentation

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.

changelog

Changelog

0.2.4 (2025-07-02)

Features

  • output: display number of merged branches (c425a94)

Reverts

  • Revert "ci(release-it): publish package in the end" (d252e72)

0.2.3 (2025-05-30)

Features

  • repo: only suggest remote delete if branch exists (1418a4a)

0.2.2 (2025-05-29)

Features

  • repo: handle detached HEAD state (e659417)

0.2.1 (2025-04-22)

Features

  • output: suggest git delete commands for merged branches (498cb0c)

0.2.0 (2025-04-16)

Features

  • add support for multiple 'issueUrlPrefix', more fine-grained 'issueUrlFormat' (37b3b74)

0.1.2 (2025-04-15)

Features

  • ignore branches on the same commit as the base branch (07e097a)

0.1.1 (2025-04-13)