pkgs: git-fixup

This commit is contained in:
Nikodem Rabuliński 2024-11-01 13:07:01 +01:00 committed by Nikodem Rabuliński
parent 6367408497
commit d56d339de7
3 changed files with 13 additions and 1 deletions

View file

@ -47,6 +47,7 @@
helix helix
fish fish
git-commit-last git-commit-last
git-fixup
]; ];
}; };
}; };

View file

@ -1,7 +1,7 @@
{ inputs, ... }: { inputs, ... }:
{ {
perSystem = perSystem =
{ pkgs, inputs', ... }: { pkgs, lib, inputs', ... }:
{ {
packages.conduit-next = pkgs.callPackage ./conduit { packages.conduit-next = pkgs.callPackage ./conduit {
src = inputs.conduit-src; src = inputs.conduit-src;
@ -16,5 +16,15 @@
git commit -eF "$GITDIR/COMMIT_EDITMSG" git commit -eF "$GITDIR/COMMIT_EDITMSG"
''; '';
}; };
packages.git-fixup = pkgs.writeShellApplication {
name = "git-fixup";
text = ''
git log -n 50 --pretty=format:'%h %s' --no-merges | \
${lib.getExe pkgs.fzf} | \
cut -c -7 | \
xargs -o git commit --fixup
'';
};
}; };
} }

View file

@ -23,6 +23,7 @@ and begin
abbr --add --global -- gd 'git diff' abbr --add --global -- gd 'git diff'
abbr --add --global -- gdd 'git diff --cached' abbr --add --global -- gdd 'git diff --cached'
abbr --add --global -- gl 'git log' abbr --add --global -- gl 'git log'
abbr --add --global -- gf 'git fixup' # See pkgs/default.nix
# Aliases # Aliases
alias cat bat alias cat bat