Last active
April 5, 2022 16:59
-
-
Save dhruv-m-patel/8c39fb4fb9ce7332aed3647dc726cce4 to your computer and use it in GitHub Desktop.
Useful 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
[filter "lfs"] | |
clean = git-lfs clean -- %f | |
smudge = git-lfs smudge -- %f | |
required = true | |
[push] | |
default = current | |
[alias] | |
a = add | |
cm = commit -m | |
co = checkout | |
cob = checkout -b | |
pr = pull --rebase | |
pf = push -f | |
logs = !git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
rbi = rebase -i | |
d = diff | |
ds = diff --stat | |
dc = diff --cached | |
st = status | |
sts = status -s | |
unstage = reset HEAD | |
changes = !git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit master.. | |
purge = "!git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D" | |
latest = !git pull && git fetch -p && git purge | |
update = !git commit --amend --no-edit | |
comp = !git checkout master && git pull && git fetch -p && git purge | |
codp = !git checkout develop && git pull && git fetch -p && git purge | |
# list branches sorted by last modified | |
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'" | |
# list aliases | |
la = "!git config -l | grep alias | cut -c 7-" | |
[color] | |
ui = true | |
[color "diff-highlight"] | |
oldNormal = red bold | |
oldHighlight = red bold 52 | |
newNormal = green bold | |
newHighlight = green bold 22 | |
[color "diff"] | |
meta = 227 | |
frag = magenta bold | |
commit = 227 bold | |
old = red bold | |
new = green bold | |
whitespace = red reverse | |
[core] | |
pager = diff-so-fancy | less --tabs=4 -RFX | |
[pull] | |
ff = only | |
[user] | |
name = <FirstName LastName> | |
email = <github email> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For diff, run
npm install diff-so-fancy -g
to be pretty :)