Live data from Hacker News

Git log – The good parts

zwischenzugs.com

51–60 of 86 posts

Re: Git log – The good parts

#51
post #37

Earlier quoted context omitted.

I used to love sourcetree, but after the redesign the whole thing became so slow I just went back to using CLI tools. Maybe it's for the better, as I can be way more flexible this way.

Atlassian seems to be really good at redesigns that make things slow. Jira anybody?

Doubly slow if you count hamburger menus.

First you load mountains of code and assets. Then you have to remember which collapsed menu is hiding your target, then you go there and look around and hit it, then wait another 15s to load the next pile of crap. Can't they at least use the real estate if you have it, instead of always hiding?

I'm tired of it. None of their thrash is benefiting me.

Re: Git log – The good parts

#52
post #50

I don't see it mentioned anywhere, but git log -N (where N is 1, 2, 3, 4...) will show the last N commits only. I find myself doing `git log -1` pretty often to see what was the last commit, so I imagine I'm not the only one.

'git show' does that too.

Re: Git log – The good parts

#53
This is my preferred git log command:

  git config --global alias.lg "log --graph --abbrev-commit --decorate --date=relative --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)' --all"
Of all the git log variants that I have come across I find this one the most clean, easy to parse, and nicely formatted. I think I found it on HN somewhere. Maybe someone finds it as useful as I did

Re: Git log – The good parts

#55
post #5

In case anyone finds these useful, here are some git log aliases I use everyday. FORMAT="%C(auto)%h %C(magenta)%ad %C(cyan)%an%C(auto)%d %s" PRETTY="--pretty=format:'$FORMAT' --date=short" git config --global alias.lga "log --graph --all $PRETTY" git config --global alias.lg "log --graph $PRETTY" git config --global alias.la "log --all $PRETTY" git config --global alias.ll "log $PRETTY" git config --global alias.lf "…

Jeez. I could never remember all that stuff.

Re: Git log – The good parts

#56
post #9
post #8

Or use sourcetree

You can't run sourcetree output through grep, sed and xargs though.

Curious, why would you run log through those? It already has flags to support getting birth the messages and the diffs.

Granted, familiarity and reflex are decent reasons.

Re: Git log – The good parts

#59
post #21
post #17

Earlier quoted context omitted.

You should probably avoid `--color`, as it turns on color unconditionally, even if output is going to a file. In older versions of Git the %C color placeholders were unconditional anyway. In modern Git, they respect the normal auto-coloring settings. You can also drop `--abbrev-commit`, since `%h` abbreviates by default (use `%H` if you want the full hash).

For the lazy: git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) %Creset'"

You can still add color when not piping or writing to a file with `--color=auto`.

      git config --global alias.lg "log --color=auto --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset'"

Re: Git log – The good parts

#60

The best part of git log is git reflog. It's like suddently having eyes to see.

My personal favorite is `git log -p --` because it actually shows you the content that changed.

Or, to show you what changed on each given single line, use `git log -p --color-words --`. Far more useful for long lines, IMO.

I'm also a fan of `git log -LN,N:filename`, where N is a line number. It gives you a log of that particular line number. It's like `git blame` but better.

Post reply on HN