DEV Community

Discussion on: The Git Aliases That Get Me To Friday

Collapse
 
bszeliga profile image
Brandon

Nice. Here are a handful of my favorites (where we don't overlap):

# What was the last commit
last=log --name-status -1 HEAD

# History of a file
history=!git log --follow --pretty=format:"$(git config --get custom.formats.ls)" --

#Nicer logs
ls=!git log --pretty=format:"$(git config --get custom.formats.ls)" --decorate
ll=!git log --pretty=format:"$(git config --get custom.formats.ls)" --decorate --name-status
graph=!git log --graph --abbrev-commit --decorate --pretty=format:"$(git config --get custom.formats.graph)"

# My version of the alias command
la=!git config -l | grep alias | cut -c 7-

# Where am I?
where=rev-parse --abbrev-ref HEAD

# Pop off that last commit
undo=reset HEAD~1 --mixed

st=status --short

# What do I have locally that's not on the server?
out=!git log --branches="*$(git rev-parse --abbrev-ref HEAD)" --not --remotes=* --pretty=format:"$(git config --get custom.formats.ls)" --decorate

# List my formats
formats=!git config -l | grep "^custom.formats" | cut -c 16-

The formats associated with above:

[custom.formats]
    ls   = "[%C(auto,yellow)%<|(10)%h%C(reset)] [%C(auto,bold blue)%<(15trunc)%cn%C(reset)]  %C(auto)%d% C(reset)%s"
    find = "[%C(yellow)%<|(20)%h%C(reset)] [%C(bold blue)%<(10)%cn%C(reset)]  %C(auto)%d %C(reset)  %s"
    graph="%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)%n %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)"