Git - Find when a method is removed
git, java
Solution
You can search for the name of the method and you will find the all commits that entered or deleted that string:
git log -c -S'methodName' /path/to/file.java
Another solution is to find the last commit in which that method exists:
$ git blame --reverse START_COMMIT.. file.ext
`START_COMMIT` is a commit in which you know for sure the method still exists. You will get a `git blame` output in which you can see the last commit in which that method existed, something like:
f590002e (user 2014-01-13 17:27:25 +0000 26) public void save() {
f590002e (user 2014-01-13 17:27:25 +0000 27) JPA.em().persist(this);
f590002e (user 2014-01-13 17:27:25 +0000 28) }
Problem
I am using Git to version control a large java project. Is it possible to know at which commit a certain method is added or removed from a certain class?