2 ms·
Say you found the current commit through `git blame`. You run `git show` on that commit. The diff shows that the function you're interested in was actually move
by js2 3y ago
Say you found the current commit through `git blame`. You run `git show` on that commit. The diff shows that the function you're interested in was actually moved so from the diff output you can see the previous filename and you have the function name. You could use:
git log -GsomeRandomFunction -- path/to/some/random/source.ext
That will then find the commit where `someRandomFunction` was removed from `source.ext` and then the commit before that where it was added to `someRandomFunction`.
Git log has a gazillion options and I've probably used them all at one time or another, but 99% of the time, the only ones I need are `-G` and following a particular file.
https://git-scm.com/docs/git-log#Documentation/git-log.txt--Gltregexgt https://git-scm.com/docs/git-log#Documentation/git-log.txt--...
I also have `diff.renames` set to "copies" and `diff.algorithm` to "patience" in my `.gitconfig`:
https://git-scm.com/docs/git-config#Documentation/git-config.txt-diffrenames https://git-scm.com/docs/git-config#Documentation/git-config...
https://git-scm.com/docs/git-config#Documentation/git-config.txt-diffalgorithm https://git-scm.com/docs/git-config#Documentation/git-config...