0

I notice that when I do git diff it would display the function name that was changed...

Is there a way to make it so that it ONLY lists the function names that got changed and not the other diff contents

Ie. I'm looking for something similar to the --name-only option, except that I want it to be the names of the changed functions instead of the changed files

pillarOfLight
  • 8,592
  • 15
  • 60
  • 90
  • 1
    `git diff` will only show the function name if the beginning of the function name happens to be in the surrounding context of a changed line. `git` itself does not track such (language-dependent) information. – chepner Dec 03 '13 at 18:15
  • 1
    You might want to use `git diff --function-context` for a start – glenn jackman Dec 03 '13 at 18:24
  • 1
    Try `git diff | grep -E '^(@@)' | grep "(" | sed 's/@@.*@@//' | sed 's/(.*//' | awk -F " " '{print $NF}' | uniq` ?... How does it work? Details in this [**answer**](http://stackoverflow.com/a/39439045/319204). – TheCodeArtist Sep 11 '16 at 18:02
  • Use `git diff -W` and `grep -E -A1` – K.Sopheak May 10 '19 at 07:18

0 Answers0