With both GIT tools and command line, what is the easiest way to find out which commit removed a particular word from a file?
The report does not tell you anything about lines which have been deleted or replaced; you need to use a tool such as git diff or the "pickaxe" interface briefly mentioned in the following paragraph.
The git blame command is used to know who/which commit is responsible for the latest changes made to a file. The author/commit of each line can also been seen. There are many other options for blame, but generally these could help.
On GitHub.com, you can access your project history by selecting the commit button from the code tab on your project. Locally, you can use git log . The git log command enables you to display a list of all of the commits on your current branch. By default, the git log command presents a lot of information all at once.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With