From fe92ab8fffcf43561d2a7f002158ab47cca541c1 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 2 Dec 2021 12:47:04 +0100 Subject: [PATCH] config/git: add unamend script --- .config/shell/git | 2 +- .local/bin/scripts/git-unamend | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100755 .local/bin/scripts/git-unamend diff --git a/.config/shell/git b/.config/shell/git index d464617..906d8d7 100644 --- a/.config/shell/git +++ b/.config/shell/git @@ -9,7 +9,7 @@ y() { yc() { local folder="${1:-${PWD/$XDG_CONFIG_HOME\/}}" echo "config/$folder:" >/tmp/yc-msg - yadm commit -v --template /tmp/yc-msg ${@:2} -- "$XDG_CONFIG_HOME/$folder"* + yadm commit -v --template /tmp/yc-msg ${@:2} -- "$XDG_CONFIG_HOME/$folder*" } gcn() { diff --git a/.local/bin/scripts/git-unamend b/.local/bin/scripts/git-unamend new file mode 100755 index 0000000..fabcc5e --- /dev/null +++ b/.local/bin/scripts/git-unamend @@ -0,0 +1,5 @@ +#!/bin/sh +# Remove the given files from the last commit +#git diff -p HEAD~ -- "$@" | git apply --reverse --cached +git reset HEAD~ "$@" +git commit --amend