GIT Aliases: git ol

OMG I tried to share this as a comment on the YT video but it is totally beyond me to get the comments to format correctly.

One of my favourite GIT aliases is…

  # log with one line per item, reversed and pretty
  ol = log --oneline --reverse --abbrev-commit --decorate --date=relative 
--format=format:'%C(bold cyan)%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)' 
-n 30

Just add into the [alias] section of git config

then type

git ol

reverse ordered list of commits in time order so most recent at the bottom

Just my 2p worth

Awesome, thanks for posting! If other people find this post in the future, this is the video @NivagSwerdna is referencing:

Thanks. I like it. Forum software made some changes to character set and format. I think quote blocks (```) are useful to avoid that, so here’s what worked after my fixes and line wrapping;

	ol = log --oneline --reverse --abbrev-commit \
	--decorate --date=relative \
	--format=format:'%C(bold cyan)%h%C(reset) -\
	%C(bold green)(%ar)%C(reset)\
	%C(dim white)-\
	%an%C(reset)%C(bold yellow)%d%C(reset)' -n 30

Thanks for fixing that. By the time I gave up on YouTube comment markup I must have rushed it here!

Some other resources that people might appreciate are…

SourceTree it used to be a freebie from Atlassian that came with stash but it seems to have been spun off. Only Windows and Mac. I’m in two minds about this one but I do use it sometimes.

Also… which has more aliases than you can shake a stick at. I don’t use these very much as I can never remember them but they are in my ~/.gitconfig

@NivagSwerdna If you like SourceTree you will love Gitkraken :

TortoiseGit is far and away my favorite git gui. The best part for me is it maps very clearly to the commands it’s running behind the scene.

Trying to do more work in cli these days though…

my favorite alias I use is:
cleanup = "!git branch --merged | egrep -v \"(^\\*|master|dev)\" | xargs git branch -d"
It’s a bit involved, but essentially it will delete any local git branches that have been merged with another branch (with the exception of master and main.