feat(git): add gitf r to force rollback the last commit

This commit is contained in:
Victor Westerlund 2026-02-24 13:43:20 +01:00
parent 0b5afb1d24
commit b6a5d0f32b
Signed by: vlw
GPG key ID: D0AD730E1057DFC6

View file

@ -223,6 +223,19 @@ gitf () {
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D 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. # Update all git submodules in this repo. "sd" for submodule download.
"sd") "sd")
# Only supports "master" as branch for now. This could cause unexpected results if a tracked submodule has a different branch or location name # Only supports "master" as branch for now. This could cause unexpected results if a tracked submodule has a different branch or location name