From 75eb66197efd13624270b07287c6bf02b06fd44f Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Tue, 24 Feb 2026 13:44:40 +0100 Subject: [PATCH] feat(git): add `gitf r` to force rollback the last commit (#115) Reviewed-on: https://codeberg.org/vlw/dotfiles/pulls/115 --- .bash_aliases | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.bash_aliases b/.bash_aliases index 3fdaf43..f3e8f33 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -223,6 +223,19 @@ gitf () { git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D ;; + "r") + local confirm + + read -p "Type 'y' to confirm force rollback of last commit: " confirm + if [ "$confirm" != "y" ]; then + echo "Aborted" + return 0 + fi + + git reset --hard HEAD^ + git push -f + ;; + # Update all git submodules in this repo. "sd" for submodule download. "sd") # Only supports "master" as branch for now. This could cause unexpected results if a tracked submodule has a different branch or location name