nearly learned git command: commit history of a file with diff’s

From http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/, I learned a git command I’ve been needing but not knowing for a while, the “-u” argument for git log, which can be applied to a certain file. So that:

git log -u some/file.txt

Ends up giving you the history of commits that touched that specific file — with a diff on that file for each commit.

git is usually capable of doing most anything you need; but I personally have had a lot of trouble learning or remembering how, or internalizing a mental model of git options and actions.

What does “-u” stand for in “git log”, where does it come from? Got me, I tried looking at the “git help log” man page, but I couldn’t even find the “-u” option mentioned there!

(The post of git tips linked above has some hints for how to get nice colorized output for some git commands, but not for this one.  But if you just set `git config –global color.ui true`, you can get some default colorization, including of `git log -u`, that to me seems fairly good, and easier to read/scan than without colorization at all.)

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s