Skip to content
loading...

I love git log

Andrew Stuntz on August 20, 2018

The title of this post should be IFLG (like IFLS, but ya know with Git). But it's probably not great to title a post with the f*** word.... [Read Full]
markdown guide
 

I forget where I found this:

alias gtree='git 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'

Then gtree in your repo.

 

I'm totally going to borrow this. I add a '%G?' to my format so it's easy to see which commits are signed or not.

 

So far I just used git log --oneline --decorate --all --graph, but I'll definitely add the --date=relative bit now.

 

Yeah, you could add git alias to long command.

 
 
 

I'm with you, Andrew - I think git log is my favorite part about Git!

I personally love using git log -S $QUERY to find out "hey, when did $QUERY appear in/disappear from the repository?" I was trying to figure out some things about what was removed between GTK 2 and 3, and -S is perfect for finding things like that!

Another log feature I love answers the question "I know I made this commit recently, and it contains the substring 'hello' - but which branch was it on?" For that I use git log --author=hoelz -G hello --all --source, which will print commits I wrote whose diff contains "hello". It searches across all branches, and prints the branch it used to find each commit.

 

Overall, it's pretty easy to see the ordering of the commits, top to bottom, first commit to last commit.

Which VCS does not do that?

What are your favorite parts of git?

To be honest, I have none. Everything Git provides is done in a similar or nearly identical way with Mercurial, the one thing both don't do too well, namely: merging incompatible branches, is the unique selling point for Darcs/Pijul.

Whenever I need to use Git, I surely prefer GitKraken. -- Alright, there is one thing Git does very well: The ecosystem of GUIs is very mature, even better than SVN's. :-)

 

tux0r - have you written any posts on Pijul or Darcs? If not, you totally should! I think it would be really interesting to see a fresh perspective on what else is out there in the VCS world, and it would be a nice chance to highlight what non-Git source control systems bring to the table. I know a lot of people feel like Git has "won", but I myself have a soft spot for Mercurial, and I think having competition is essential to innovation in the space!

 

I find it sad to see that Atlassian does not advertise their own support for Mercurial. All you can find in their ads is Git here, Git there...

I haven't worked with Pijul yet. I made an account in their "nest" a while ago, but it's all too alpha-quality just yet. I have some private code on Darcshub though. No, I have not written anything about Darcs (yet?), Haskell is not my usual habitat. But I recommend everyone to spend half an hour with it. If you're not sold after that, you never will.

I find it sad to see that Atlassian does not advertise their own support for Mercurial.

Nah, Atlassian does only what makes sales go high. Got a serious bug in Atlassian product? Wait few years until we finish new shiny graphical UI first!

 

Which VCS does not do that?

Just trying to start out on the right foot.

the one thing both don't to too well, namely: merging incompatible branches, is the unique selling point for Darcs/Pijul.

I haven't used Darcs/Pijul before. But, I plan on writing somethings about merging/rebasing difficult branches. Which, probably isn't too different than what most people do, but there are ways to make merging less painful.

Whenever I need to use Git, I surely prefer GitKraken.

Yeah, I have used GitKraken, its the closest thing to a usable git GUI that I would use.

 

I was disappointed with SourceTree.

I like Cycligent.

I thought GitKraken had the prettiest UI of the front-ends I've seen.

The only two problems I experienced with GitKraken, which is from a year or two ago:

  • abysmally slow (hopefully fixed by now...)
  • no Git LFS support (hopefully fixed by now...)

It is still slow because it still uses Electron AFAIK.

I've not tried cycligent but SourceTree was a pain to set up (especially on windows) and GitKraken is still deadly slow AFAIK.

The one I always come back to, and which I find awesome, is SmartGit, not focusing on the "beautiful" aspect but the features. And for now, it haven't missed any feature !

slow because it still uses Electron AFAIK

Electron apps don't have to be slow....

Postman is quite heavy if you have several collections etc.

Takes a few seconds to open.

Insomnia, a smaller and "more basic" alternative to Postman is quite faster though.

But there's a seriously noticeable difference in terms of boot speed, RAM usage and lag, between electron and native softwares.

 

Sourcetree is pretty good, though they have some annoying bugs once in a while.

 

I have found these git aliases to be helpful. Paste this into your ~/.gitconfig file.

[alias]
    lg = !"git lg1"
    lg1 = !"git lg1-specific --all"
    lg2 = !"git lg2-specific --all"
    lg3 = !"git lg3-specific --all"

    lg1-specific = log --graph --abbrev-commit --decorate --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(auto)%d%C(reset)'
    lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n''%C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
    lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n''          %C(white)%s%C(reset)%n''          %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'

git lg
git lg

git lg2
git lg2

git lg3
git lg3

courtesy of: stackoverflow.com/a/34467298/504836

 

There seems to be a typo in the last command for

git log --online --graph --color

it should be

git log --oneline --graph --color

 

Yes! My bad. I'll fix it when I get a chance.

 
 
 
 

I don't think you meant to put your personal email address here!

code of conduct - report abuse