DEV Community

Discussion on: Work faster with Git aliases

Collapse
 
bsara profile image
Brandon Sarà • Edited

I love aliases so much, I have A TON, but the most useful are these:

rv = !git stash && git stash drop

pr = remote update --prune

rmb = !sh -c 'git push origin :refs/heads/$1 && git branch -D $1' -
rmt = !sh -c 'git push origin :refs/tags/$1 && git tag -d $1' -

This next list is all of the log aliases that I have...and I'd be lost without them:

l   = log --abbrev-commit --first-parent --pretty=format:'%C(dim white)%h%C(reset)%C(bold green)%d%C(reset) %s %C(yellow)<%an>%C(reset)'
ll  = log --abbrev-commit --graph --pretty=format:'%C(dim white)%h%C(reset)%C(bold green)%d%C(reset) %s %C(yellow)<%an>%C(reset)'

ld  = log --abbrev-commit --first-parent --pretty=format:'%C(bold blue)%ai%C(reset) - %C(dim white)%h%C(reset)%C(bold green)%d%C(reset) %s %C(yellow)<%an>%C(reset)'
lda = log --abbrev-commit --graph --pretty=format:'%C(bold blue)%ai%C(reset) - %C(dim white)%h%C(reset)%C(bold green)%d%C(reset) %s %C(yellow)<%an>%C(reset)'

la  = log --abbrev-commit --name-status --first-parent --pretty=format:'%C(dim white)%h%C(reset)%C(bold green)%d%C(reset) %s %C(yellow)<%an>%C(reset)'
lla = log --abbrev-commit --name-status --pretty=format:'%C(dim white)%h%C(reset)%C(bold green)%d%C(reset) %s %C(yellow)<%an>%C(reset)'

lg  = !git lg1
lg1 = !git lg1-specific --all
lg2 = !git lg2-specific --all
lg3 = !git lg3-specific --all

lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset)%n''          %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'