Last active
January 24, 2024 19:28
-
-
Save anied/fb7b9abdfe861205b23ed78be2a05a1a to your computer and use it in GitHub Desktop.
My Git Aliases
This file contains 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
# Mostly the same as git-alias.sh, but simplified for Oh My Zsh (because it handles the piping to a text buffer for you) | |
# Nice logs | |
git config --global alias.l 'log --graph --decorate --branches --remotes' | |
# Nice condensed logs | |
git config --global alias.lp 'log --graph --decorate --branches --remotes --pretty=format:"%C(auto) %h %d %s"' | |
# Diff | |
git config --global alias.d 'diff' | |
# Diff Staged | |
git config --global alias.ds 'diff --staged' | |
# Status | |
git config --global alias.s 'status -u' | |
# Clear all changes and untracked files | |
git config --global alias.wipe '! git reset --hard && git clean -f -d' | |
# Checkout | |
git config --global alias.c 'checkout' | |
# Branch | |
git config --global alias.b 'branch' | |
# Generate rebase rescue tag | |
git config --global alias.rrt '!f() { \ | |
local x="$1"; \ | |
local timestamp=$(date "+%Y%m%d%H%M"); \ | |
local tag="RR_${x}_$timestamp"; \ | |
git tag "$tag"; \ | |
}; f' | |
# See all aliases | |
git config --global alias.aliases 'config --get-regexp alias' |
This file contains 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
# A list of all the git aliases I've been cultivating over the years | |
# Nice logs | |
git config --global alias.l '! git log --graph --decorate --branches --remotes --color=always | less -r' | |
# Nice condensed logs | |
git config --global alias.lp '! git log --graph --decorate --branches --remotes --pretty=format:"%C(auto) %h %d %s" --color=always | less -r' | |
# Diff | |
git config --global alias.d '! git diff --color=always | less -r' | |
# Diff Staged | |
git config --global alias.ds 'diff --staged --color=always | less -r' | |
# Status | |
git config --global alias.s 'status -u' | |
# Clear all changes and untracked files | |
git config --global alias.wipe '! git reset --hard && git clean -f -d' | |
# Checkout | |
git config --global alias.c 'checkout' | |
# Branch | |
git config --global alias.b '! git branch --color=always | less -r' | |
# Generate rebase rescue tag | |
git config --global alias.rrt '!f() { \ | |
local x="$1"; \ | |
local timestamp=$(date "+%Y%m%d%H%M"); \ | |
local tag="RR_${x}_$timestamp"; \ | |
git tag "$tag"; \ | |
}; f' | |
# See all aliases | |
git config --global alias.aliases '! git config --get-regexp alias' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment