aboutsummaryrefslogtreecommitdiff
path: root/Documentation/user-manual.txt
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2007-05-19 00:37:25 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2007-05-19 01:00:55 -0400
commit187b0d80dfad2f51df580bffbbc1e7bc2103f6d4 (patch)
treecafe8af3d34b33661f15b193a83d8747006fb4d1 /Documentation/user-manual.txt
parent8fae22250fab25bc59efe24e849a7e9f20e3386c (diff)
downloadgit-187b0d80dfad2f51df580bffbbc1e7bc2103f6d4.tar.gz
git-187b0d80dfad2f51df580bffbbc1e7bc2103f6d4.tar.xz
user-manual: finding commits referencing given file content
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>
Diffstat (limited to 'Documentation/user-manual.txt')
-rw-r--r--Documentation/user-manual.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 1ab3d4b87..222171be3 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -921,6 +921,22 @@ echo "git diff --stat --summary -M v$last v$new > ../diffstat-$new"
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
===================