📝 Notes

Git Undo Commit

Published: July 31, 2025


git reset --soft HEAD~1

This command undoes the last commit but keeps your changes staged.

Git delete all local branches

Published: July 31, 2025


git branch | grep -v -E "(dev$|master$|stage$|\*)" | xargs git branch -D


git branch | grep -v -E "{PATTERN}" | xargs git branch -D

This command deletes all local branches except for the ones that match {PATTERN}.