I need to get
- the changed files names
- for every added line, its line number
E.g. given this commit, I want to get compat/unsetenv.c and 5,6,7.
I was trying to use
git show <commit-id> and do some dirty string matching on it. I can get away with a
| grep +++ for the file name, but I found no way of making git show the line number next to the + sign, as in the GitHub web interface.
Is there any other way to find the (added) line numbers?
git blameshows line numbers. Will that work?git blame --porcelain <filename> | grep <id> | awk '{print $2}'does the job. It still feels like a messy way of doing it, but as long as it works...