summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8fae222)
raw | patch | inline | side by side (parent: 8fae222)
author | J. Bruce Fields <bfields@citi.umich.edu> | |
Sat, 19 May 2007 04:37:25 +0000 (00:37 -0400) | ||
committer | J. Bruce Fields <bfields@citi.umich.edu> | |
Sat, 19 May 2007 05:00:55 +0000 (01:00 -0400) |
Another amusing git exploration example brought up in irc. (Credit to
aeruder for the complete solution.)
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
aeruder for the complete solution.)
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Documentation/user-manual.txt | patch | blob | history |
index 1ab3d4b87fb3f061cf7fdc11d188ace5de326795..222171be301761d587d9caab01f705c9d0f01604 100644 (file)
and then he just cut-and-pastes the output commands after verifying that
they look OK.
+Finding commits referencing a file with given content
+-----------------------------------------------------
+
+Somebody hands you a copy of a file, and asks which commits modified a
+file such that it contained the given content either before or after the
+commit. You can find out with this:
+
+-------------------------------------------------
+$ git log --raw -r --abbrev=40 --pretty=oneline -- filename |
+ grep -B 1 `git hash-object filename`
+-------------------------------------------------
+
+Figuring out why this works is left as an exercise to the (advanced)
+student. The gitlink:git-log[1], gitlink:git-diff-tree[1], and
+gitlink:git-hash-object[1] man pages may prove helpful.
+
[[Developing-with-git]]
Developing with git
===================