Git Log & Status Aliases
A month or so ago I posted a decent format for Git logs. Now I’m back with an even better one, and a format for the status command as well.
We all hate the default log’s waste of vertical screen real estate:
I’ve wrote a line in my bash script I use to re-initialize Git configurations every week or so. I suggest doing it this way, because you can make bulk changes to your configuration without having to muck around in the .git folder amongst the objects containing your versioned source.
#!/bin/bash git config --global alias.l "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
Run this, and voila:
We see the abbreviated SHA hash for each commit, which commit is the remote and local HEAD, the date relative to the current date, and author for each commit. Not to mention: colours! (Woo hoo!)
You’re welcome.
Git Status
This alias is entirely formatting for readability and doesn’t actually present the reader with any new information.
git config --global alias.st "status -s -b -uall"
The staged or unstaged modifications, additions, and deletions should now be files marked with colour coded abbreviations, instead of being in separated lists.
That concludes today’s Git lecture. 🙂