jtzero / git-cleanup-merged-pr-branches

git command and hook that deletes local branches when a matching PR is merged MIRROR of https://gitlab.com/jtzero/git-cleanup-merged-pr-branches

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GCMPB git-cleanup-merged-pr-branches

broom

pipeline status

Installation

Dependencies

  1. One or more CLI's that correspond to the server you are using:
  2. gnu-coreutils >= 8.32
  3. git >= 2.22.0
  4. jq ~> 1.6

Install as only post-checkout git hook

Steps

  1. clone repo and set up git hooks and set gcmpb as the post-checkout hook
    git clone git@gitlab.com: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"

Install as extendable post-checkout hook

Steps

  1. ensure git-cleanup-merged-pr-branches-git-hook is in your PATH varaible
  2. clone repo and set up git hooks
    git clone git@gitlab.com: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"
  3. copy the templates/custom-post-checkout-hook and past it into ~/.git-hooks/post-checkout
  4. chmod +x ~/.git-hooks/post-checkout
  5. modify below # other things

Usage as post-checkout hook with first time log in

  • 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.

asciicast

Usage Info

bin/git-cleanup-merged-pr-branches-git-hook help OR bin/git-cleanup-merged-pr-branches help

API's supported

  • Github
  • GitLab
  • Azure

About

git command and hook that deletes local branches when a matching PR is merged MIRROR of https://gitlab.com/jtzero/git-cleanup-merged-pr-branches

License:Other


Languages

Language:Shell 97.7%Language:Dockerfile 2.3%