DEV Community

Discussion on: Your favorite `git` aliases?

Collapse
 
mattiaslundberg profile image
Mattias Lundberg

Shorthand for using git (bash/zsh alias):

alias g=git

Undo the last commit:

undo = reset --soft HEAD^

Get a summary of commits since yesterday (useful during standups):

standup = !"git log --reverse --branches --since=$(if [[ "Mon" == "$(date +%a)" ]]; then echo "friday"; else echo "yesterday"; fi) --author=$(git config --get user.email) --format=format:'%C(cyan) %ad %C(yellow)%h %Creset %s %Cgreen%d' --date=local"

Push to origin:

pp = push origin

Force push to origin:

ppf = push origin --force-with-lease

Pretty log:

lol = log --pretty=format:"%C(yellow)%h\\ %Cblue%G?%Cred%d\\ %Creset%s%Cgreen\\ (%cr)%Cblue\\ [%cn]" --decorate --graph