TheSwamp

Code Red => .NET => Topic started by: kdub_nz on April 19, 2023, 06:00:02 PM

Title: nice git alias
Post by: kdub_nz 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
Title: Re: nice git alias
Post by: JohnK 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.