Wednesday, November 28, 2012

git what changed

So, let's see you just did a git pull, and you have a feeling the last few (let's say 4) commits are by a coupla not-so-bright people, and you want to take a look at the code added by them, commit by commit, file by file. One way would have been to just take the diff between HEAD and HEAD^^^^, but that it will only show you the net change, so what you can do is is this:
git whatchanged -p -4 --pretty=full
By the way, doing the following would get the same output as well:
git log -p4
Also, my boss asked me to come up with a way to find the commit history of just one file. I said, git would provide a functionality right away, let me look. He said no, don't 'waste' time on it. Well, here it is. I just stumbled upon it while fiddling with git log.
git log -p -4 /path/to/file
And if you wanna see the history of a Deleted file...
git log --follow -- /path/to/file
Needless to say, this can only be done for one file.

No comments:

Post a Comment