My favorite is git h, which produces a nicely summarized log of commits on the current branch, with some highlighting and relative dates:

[alias]
    h = log --graph  --abbrev-commit --date=relative --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'

What’s your favorite Git alias?

  • @canpolatM
    link
    English
    3
    edit-2
    1 year ago

    Found one on “another site”:

    I occasionally fat finger the git add command:

    $ git dad .
    git: 'dad' is not a git command. See 'git --help'.
    
    Did you mean this?
      add
    

    So today I fixed it:

    $ git config --global alias.dad '!curl https://icanhazdadjoke.com/ && git add'
    

    And now my clumsy typing is rewarded with comedic gold:

    $ git dad .
    I used to hate facial hair, but then it grew on me.
    

    Since git’s aliasing system passes any parameters on to the underlying command, your git add operation completes normally and you get a bonus dad joke.