Git and Less Colors
This is a not so technical article since it just gives a tip on how to set up your less command to display nice colors for git log, git status and other stuff.
Git Colors First
execute this commands in your console:
git config --global color.diff auto git config --global color.status auto git config --global color.branch auto
You need to run this commands, otherwise, git itself won't generate color codes embedded in output.
Now Less
Setting up less is easy, just add this line to your .bashrc, or you can run it directly on your console to test it right away.
export LESS="-RS#3NM~g"
- R
- Raw color codes in output (don't remove color codes)
- S
- Chop long lines, instead of wrapping.
- #3
- Scroll 3 columns horizontally at a time.
- N
- Show line numbers
- M
- Long prompts
- ~
- Don't show those weird ~ symbols on lines after EOF
- g
- Hilite results when searching with slash key (/)
Hope this is useful for you, I added a sample so you can see how it looks.
Thanks for your visit.

