Last active
June 29, 2025 05:41
-
-
Save EconoBen/0a09d84947062d7928bb726d07329a59 to your computer and use it in GitHub Desktop.
[workshop] category:git tags:git,bash,productivity,version-control - Git Cleanup Aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add to ~/.gitconfig | |
| [alias] | |
| # Delete merged branches | |
| cleanup = "!git branch --merged | grep -v '\*' | xargs -n 1 git branch -d" | |
| # Show branches by last commit date | |
| recent = "!git for-each-ref --sort='-committerdate' --format='%(refname:short)' refs/heads | head -20" | |
| # Interactive rebase for last n commits | |
| fixup = "!f() { git rebase -i HEAD~$1; }; f" | |
| # Show a pretty log | |
| lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" | |
| # Undo last commit but keep changes | |
| undo = "reset HEAD~1 --soft" | |
| # Amend last commit without editing message | |
| amend = "commit --amend --no-edit" | |
| # List aliases | |
| aliases = "config --get-regexp alias" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment