Delete branches that have been squashed and merged into master
npm install @mtripg6666tdr/git-delete-squashed or develop.
`bash
$ npm install --global @mtripg6666tdr/git-delete-squashed
$ git-delete-squashed
$ # or simply
$ gds
$ # Specify a different branch name like so
$ git-delete-squashed main
`
Alternatively, you can create .gds (or .git-delete-squashed) file to specify your default branch name.
.git-delete-squashed
`json
{
"namespace": "@mtripg6666tdr/git-delete-squashed",
"defaultBranch": "main"
}
`
> namespace is optional key.
Details
To determine if a branch is squash-merged, git-delete-squashed creates a temporary dangling squashed commit with git commit-tree. Then it uses git cherry` to check if the squashed commit has already been applied to the default branch. If so, it deletes the branch.