File tree Expand file tree Collapse file tree 5 files changed +18
-6
lines changed Expand file tree Collapse file tree 5 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 2020 }
2121 },
2222 "hooks" : {
23+ "before:init" : [" npm run lint:all" , " npm run test" ],
2324 "after:bump" : " npm run build"
2425 }
2526}
Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## [ 0.1.2] ( https://github.com/VChet/git-merged-branches/compare/0.1.1...0.1.2 ) (2025-04-15)
4+
5+ ### Features
6+
7+ * ignore branches on the same commit as the base branch ([ 07e097a] ( https://github.com/VChet/git-merged-branches/commit/07e097ac159b47346061031350d14225ed2e5f06 ) )
8+
39## [ 0.1.1] ( https://github.com/VChet/git-merged-branches/compare/0.1.0...0.1.1 ) (2025-04-13)
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ Example configuration:
4747
4848``` json
4949"git-merged-branches" : {
50- "issueUrlFormat" : " https://your-jira-instance.net" ,
50+ "issueUrlFormat" : " https://your-jira-instance.net/browse " ,
5151 "issueUrlPrefix" : " TOKEN"
5252}
5353```
Original file line number Diff line number Diff line change 22 "name" : " git-merged-branches" ,
33 "description" : " CLI tool to list all Git branches merged into a base branch with issue link formatting" ,
44 "type" : " module" ,
5- "version" : " 0.1.1 " ,
5+ "version" : " 0.1.2 " ,
66 "license" : " MIT" ,
77 "author" : {
88 "name" : " VChet" ,
3131 "lint:js" : " eslint ." ,
3232 "lint:js:fix" : " npm run lint:js -- --fix" ,
3333 "lint:all" : " npm run lint:ts && npm run lint:js" ,
34- "test" : " vitest" ,
34+ "test" : " vitest --run " ,
3535 "release" : " release-it"
3636 },
3737 "devDependencies" : {
Original file line number Diff line number Diff line change @@ -27,11 +27,16 @@ export function getDefaultTargetBranch(): string | null {
2727}
2828
2929export function getMergedBranches ( targetBranch : string ) : string [ ] {
30+ const baseCommit = execSync ( `git rev-parse ${ targetBranch } ` , { encoding : "utf-8" } ) . trim ( ) ;
3031 const output = execSync ( `git branch --merged ${ targetBranch } ` , { encoding : "utf-8" } ) ;
3132 return output . split ( "\n" ) . reduce ( ( acc : string [ ] , line ) => {
32- const branch = line . trim ( ) ;
33- if ( branch && ! branch . includes ( targetBranch ) ) { return [ ...acc , branch ] ; }
34- return acc
33+ // Ignore empty lines
34+ const branch = line . replace ( '*' , '' ) . trim ( ) ;
35+ if ( ! branch ) { return acc ; }
36+ // Ignore branches on the base commit
37+ const branchCommit = execSync ( `git rev-parse ${ branch } ` , { encoding : "utf-8" } ) . trim ( ) ;
38+ if ( branchCommit === baseCommit ) { return acc ; }
39+ return [ ...acc , branch ] ;
3540 } , [ ] ) ;
3641}
3742
You can’t perform that action at this time.
0 commit comments