diff --git a/scripts/default.nix b/scripts/default.nix index c621d47..24eded1 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -125,6 +125,12 @@ zbar wl-clipboard ]; + git_clean_remote_deleted = [ + git + gnugrep + gawk + findutils + ]; pint-fmt = [ ]; powerplay-led-idle = [ bash diff --git a/scripts/git_clean_remote_deleted b/scripts/git_clean_remote_deleted new file mode 100755 index 0000000..99bc93d --- /dev/null +++ b/scripts/git_clean_remote_deleted @@ -0,0 +1,6 @@ +#!/bin/sh + +git branch -vv \ +| grep ': gone]' \ +| awk '{print $1}' \ +| xargs git branch -D diff --git a/user/git.nix b/user/git.nix index 94532f3..867b9a5 100644 --- a/user/git.nix +++ b/user/git.nix @@ -36,8 +36,13 @@ in alias = { graph = "log --graph --oneline --branches"; root = "rev-parse --show-toplevel"; + clean-deleted-remotes = "!" + (lib.getExe pkgs.git_clean_remote_deleted); }; }; }; + + home.packages = with pkgs; [ + git_clean_remote_deleted + ]; }; }