7

With both GIT tools and command line, what is the easiest way to find out which commit removed a particular word from a file?

Glide
  • 18,765
  • 23
  • 75
  • 124

3 Answers3

10

You could use the methods described in this post:

If you know the contents of the line, this is an ideal use case for:

git log -S<string> path/to/file
git log -G<regex> path/to/file

Or you could try:

git blame --reverse
Community
  • 1
  • 1
BenC
  • 8,379
  • 3
  • 48
  • 67
  • I'm accepting this answer. But I actually forgot to mention a few details in this question. I created another post with more details for my questions: http://stackoverflow.com/questions/16203763/find-the-latest-commit-that-had-a-particular-word-line-in-git – Glide Apr 24 '13 at 23:10
1

git blame will show you the most recent commit that changed each line of a file. You can use that on your file, and then go to the line where your word is.

Waynn Lue
  • 11,254
  • 8
  • 50
  • 74
0

Type gitk in command line it would show the graphical tool for comparisons of the file.

(OR)

   $ git log -p

One of the more helpful options is -p, which shows the diff introduced in each commit.

uday
  • 8,240
  • 4
  • 29
  • 51