Author Topic: nice git alias  (Read 1989 times)

0 Members and 1 Guest are viewing this topic.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2125
  • class keyThumper<T>:ILazy<T>
nice git alias
« on: April 19, 2023, 06:00:02 PM »
I don't use the command-line often, mostly use GitKraken and git from VS diectly

but came across this neat alias for the command-line
One time setup:
Code: [Select]
$ git config --global alias.logline "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
Then just use
Code: [Select]
$ git logline
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: nice git alias
« Reply #1 on: April 19, 2023, 09:22:34 PM »
That's a nice one.

I'm not sure this one will work in Windows--in Unix the command line will "pause" after so many lines and you can scroll up/down--but this one is a more spread out version that I like every now and again.
Code: [Select]
git config --global alias.pretylog "log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(red)%h%C(reset) %C(dim white):%C(reset) %C(green)(%ar)%C(reset) %C(red)~%C(reset) %C(dim white)%an%C(reset) %C(bold yellow)%d%C(reset) %n''   %C(white)%s%C(reset) %n ' --all"
Code: [Select]
git pretylog
I also have a few of these types of entries in my gitconfig file for creating a quick branch.
Code: [Select]
git config --global alias.stupid "branch testing | git checkout testing"
That way when I get a dumb/stupid idea I can just use "git stupid" to create a quick branch to test something.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org