9

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
  • 20,235
  • 26
  • 86
  • 135

3 Answers3

11

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,729
  • 3
  • 49
  • 68
  • 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,344
  • 8
  • 51
  • 76
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,544
  • 4
  • 30
  • 54