Live data from Hacker News

Git log – The good parts

zwischenzugs.com

21–30 of 86 posts

Re: Git log – The good parts

#21
post #17
post #6

For those increasingly rare times I'm not using Magit[0], I have a "git lg" alias I found once through HN[1]: git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) %Creset' --abbrev-commit" I strongly recommend both. -- [0] - https://magit.vc/ [1] - https://coderwall.com/p/euwpig/a-better-git-log

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'"

Re: Git log – The good parts

#22
post #6

For those increasingly rare times I'm not using Magit[0], I have a "git lg" alias I found once through HN[1]: git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) %Creset' --abbrev-commit" I strongly recommend both. -- [0] - https://magit.vc/ [1] - https://coderwall.com/p/euwpig/a-better-git-log

lol, I named my alias `git lol` because it is logs in one line.

Re: Git log – The good parts

#24
post #11

Earlier quoted context omitted.

Sourcetree is awful and slow. There is git gui by default, which is not perfect but IMO better that cli. I actually use Git Extensions for years now and could not find anything better.

Which Git GUI present by default do you find better than CLI? gitk? Or do you have something else in mind?

This one where you just type in 'git gui' and it pops up. https://git-scm.com/docs/git-gui

Re: Git log – The good parts

#25

Earlier quoted context omitted.

The ones distributed in Ubuntu and MinGW do. Probably many others as well. EDIT: Or not. It's off by default actually.

Which version of Ubuntu? The last time I checked, --all was not enabled by default in Ubuntu? Can someone confirm if this is indeed true? If this is indeed true, how do they achieve this? Do they modify git source code to achieve this?

You can't override existing Git commands with aliases.

Re: Git log – The good parts

#26

Earlier quoted context omitted.

The ones distributed in Ubuntu and MinGW do. Probably many others as well. EDIT: Or not. It's off by default actually.

Which version of Ubuntu? The last time I checked, --all was not enabled by default in Ubuntu? Can someone confirm if this is indeed true? If this is indeed true, how do they achieve this? Do they modify git source code to achieve this?

Nevermind, I made a mistake and tested it on a repo where ---all would have little noticeable effect. It is indeed disabled by default. That said, custom source edits are entirely possible. Canonical does keep their own repositories after all [1].

[1] - https://launchpad.net/git

Re: Git log – The good parts

#27
post #6

For those increasingly rare times I'm not using Magit[0], I have a "git lg" alias I found once through HN[1]: git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) %Creset' --abbrev-commit" I strongly recommend both. -- [0] - https://magit.vc/ [1] - https://coderwall.com/p/euwpig/a-better-git-log

Many of us at work have the following alias in our .gitconfig file:

lola = log --graph --decorate --pretty=oneline --abbrev-commit --all

This is similar to others posted here.

Re: Git log – The good parts

#28
post #4

Commands in the article: git clone https://github.com/ianmiell/cookbook-openshift3-frozen cd cookbook-openshift3-frozen git log git log --oneline git log --oneline --decorate git log --oneline --decorate --all git log --oneline --decorate --all --graph git log --oneline --decorate --all --graph --simplify-by-decoration git log --oneline --decorate --all --graph --stat git log -G 'chef-client' --graph --oneline --stat…

A quick mnemonic I read on StackOverflow[1] some time ago: When using git log, do it like "a dog" git log --all --decorate --oneline --graph I must say I had forgotten about the `--all` part, but the article mentions that it should be on by default if running interactively in the terminal, at least with recent versions of git. [1]It might have been https://stackoverflow.com/questions/1057564/pretty-git-branc... but I…

I don't believe the article's claim about --all being on by default is true.

Re: Git log – The good parts

#29
post #6

For those increasingly rare times I'm not using Magit[0], I have a "git lg" alias I found once through HN[1]: git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) %Creset' --abbrev-commit" I strongly recommend both. -- [0] - https://magit.vc/ [1] - https://coderwall.com/p/euwpig/a-better-git-log

I use a light variant from it :

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

Re: Git log – The good parts

#30
post #24

Earlier quoted context omitted.

Which Git GUI present by default do you find better than CLI? gitk? Or do you have something else in mind?

This one where you just type in 'git gui' and it pops up. https://git-scm.com/docs/git-gui

`git gui` is not a commit tree browser though. It's used for making commits.
Post reply on HN