- One or more CLI's that correspond to the server you are using:
- https://gitlab.com/gitlab-org/cli
- https://cli.github.com/
- https://learn.microsoft.com/en-us/cli/azure/install-azure-cli &
az extension add --name azure-devops
- gnu-coreutils >= 8.32
- git >= 2.40.0
- jq ~> 1.6
- clone repo and set up git hooks and set gcmpb as the post-checkout hook
git clone [email protected]:jtzero/git-cleanup-merged-pr-branches.git "${XDG_DATA_HOME:-${HOME}/.local/share}/git-cleanup-merged-pr-branches" --branch stable \ && mkdir "${HOME}/.git-hooks" \ && git config --global core.hooksPath "${HOME}/.git-hooks" \ && ln -nfs "${XDG_DATA_HOME:-${HOME}/.local/share}/git-cleanup-merged-pr-branches/bin/git-cleanup-merged-pr-branches-git-hook" "${HOME}/.git-hooks/post-checkout"
- ensure
git-cleanup-merged-pr-branches-git-hook
is in your PATH varaible - clone repo and set up git hooks
git clone [email protected]:jtzero/git-cleanup-merged-pr-branches.git "${XDG_DATA_HOME:-${HOME}/.local/share}/git-cleanup-merged-pr-branches" --branch stable \ && mkdir "${HOME}/.git-hooks" \ && git config --global core.hooksPath "${HOME}/.git-hooks"
- copy the templates/custom-post-checkout-hook and past it into ~/.git-hooks/post-checkout
chmod +x ~/.git-hooks/post-checkout
- modify below
# other things
- cd into repo you want to add this as a hook to
- clone repo and set post-checkout to gcmpb
git clone [email protected]:jtzero/git-cleanup-merged-pr-branches.git "${XDG_DATA_HOME:-${HOME}/.local/share}/git-cleanup-merged-pr-branches" --branch stable \ && ln -nfs "${XDG_DATA_HOME:-${HOME}/.local/share}/git-cleanup-merged-pr-branches/bin/git-cleanup-merged-pr-branches-git-hook" "./.git/hooks/post-checkout"
- The first time you use the hook it will ask you to log in to the respective VCS server.
- Then once you have switched branches, if any branches have a PR that has been merged or closed, the tui will ask you if you want to delete it.
bin/git-cleanup-merged-pr-branches-git-hook help
OR bin/git-cleanup-merged-pr-branches help
- Github
- GitLab
- Azure