Hacker News new | past | comments | ask | show | jobs | submit login

Here are two variations that I find useful day-to-day.

1. Graph showing commits on all branches, decorated with branch and tag names, short commit hashes, committer name and commit comment:

    git log --graph --all --abbrev-commit --pretty=format:'%C(red)%d%x20%C(yellow)%h%x20%C(green)%an%x20%Creset%s'
2. List commits in HEAD that aren't in master:

    git log --abbrev-commit --pretty=format:'%C(yellow)%h%x20%C(green)%an%x20%Creset%s' master..HEAD



you can get a slightly more reliable list of commits that are in HEAD that aren't in master using --not:

    git log HEAD --not master
or the shorthand

    git log HEAD ^master


What terminal does this work in? I just got raw escape codes.


Oh, I had no idea it wasn't portable, sorry. I'm using iTerm2 on OSX, but maybe worth trying them without the colouring:

    git log --graph --all --abbrev-commit --pretty=format:'%d%x20%h%x20%an%x20%s'
    git log --abbrev-commit --pretty=format:'%h%x20%an%x20%s' master..HEAD


Those work, thanks. I'm on Linux using xfce4-terminal at the moment. There's probably a way to get the color codes to work, but I don't know it.


Which PAGER are you using? If it's less, try setting PAGER='less -R', or LESS=-R to enable raw control character output.


Bingo! Nothing to do with the terminal at all! Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: