Using git to identify all modified functions in a revision

git diff commit
git diff head
git diff format

Is there a good way to use git to identify all the modified functions in each revision in the history? I've tried using the -p switch, but it doesn't seem to work in the same way that svn's show-c-function parameter works.

My assumption is that I'll want to use "git diff HEAD~i HEAD~i-1 -p" for increasing values of i. Am I missing some parameters that will help identify diff's best guess on the functions that were modified?


Here's a quick and dirty attempt at what I think you're going for. It does a git log to show all revisions, -p to include the diff in the log, a grep to only include the lines containing the commit ID and the hunk headers, and uses sed to filter out the line numbers, leaving only the guess at the function name that Git writes after the hunk header.

git log -p | grep -E '^(commit|@@)' | sed 's/@@.*@@//'

Tracking changes in a file, Is there a good way to use git to identify all the modified functions in each revision in the history? I've tried using the -p switch, but it doesn't seem to work in the  Revision Selection. Git allows you to refer to a single commit, set of commits, or range of commits in a number of ways. They aren’t necessarily obvious but are helpful to know. You can obviously refer to any single commit by its full, 40-character SHA-1 hash, but there are more human-friendly ways to refer to commits as well.


Here is a magic chant to list functions within a git diff *

git diff |                  \
grep -E '^(@@)' |           \
grep "(" |                  \
sed 's/@@.*@@//' |          \
sed 's/(.*//' |             \
awk -F " " '{print $NF}' |  \
uniq

...and what it does is...

  1. Picks the current diff,
  2. next picks only lines with "hunk-headers" ,
  3. next picks only lines with opening parenthesis (as potentially containing function names),
  4. next ignores the hunk headers,
  5. next ignores the text after the opening parenthesis,
  6. next picks only the word immediately before the opening parenthesis,
  7. and lastly ignores multiple occurrences of the same word in the list.

Voila! you have a list of functions being modified by the current git diff.


* Verified using git version 2.7.4 on Ubuntu 16.04 running bash.

git-blame Documentation, With the blame view, you can view the line-by-line revision history for an entire file, or view the revision history of a single line within a file by clicking . Each time​  git ls-added-deleted-methods List modified Java methods in the current branch, compared to master: git ls-modified-methods TODO (contributions and pull-requests welcome) add a way to configure the path to spoon-core-*-jar-with-dependencies.jar; See also


git-diff Documentation, git-blame - Show what revision and author last modified each line of a file detect lines moved or copied from other files that were modified in the same commit. Use the following command: git diff --name-only <SHA, tag start> <SHA, tag end>. This will use the diff command but will only output the file names rather than the changes within each file. For example, we can get the names of all the files that have changed in the last 3 commits: git diff --name-only HEAD HEAD~3.


Viewing the Commit History, In other words, the differences are what you could tell Git to further add to the index You can omit any one of <commit>, which has the same effect as using HEAD In the above example output, the function signature was changed from both  In a file or pull request, you can also use the menu to view Git blame for a selected line or range of lines. Tip: On the command line, you can also use git blame to view the revision history of lines within a file.


Recording Changes to the Repository, As you can see, this command lists each commit with its SHA-1 checksum, the Show the list of files modified after the commit information. to find the last commit that added or removed a reference to a specific function, you could call:. This section looks at functions within the wider topic of Algebra. A function may be thought of as a rule which takes each member x of a set and assigns, or maps it to the same value y known at its image. A letter such as f, g or h is often used to stand for a function. The Function which squares a number and adds on a 3, can be written as f (x


Git and GitHub · R packages, As you work, you selectively stage these modified files and then commit all those start including it in your commit snapshots until you explicitly tell it to do so. to unstage) new file: README Changes not staged for commit: (use "git add <file>. is that git mv is one command instead of three — it's a convenience function. Since this function is only ever invoked from the base directory of the LDC source tree, it does not need to recurse in order to get the correct git revision for LDC. This patch therefore adds a parameter that can be set to `TRUE` or `FALSE` depending on whether one wants to use recursion or not, and sets it to false in when calling `get_git_head_revision` in LDC's own `CMakeLists.txt`.