git mergers full path to files
Good day I need to find a way to find the full path of changed files when reported 开发者_StackOverflowafter a git merge. Git generally puts a .../rest/of/path/to/the/file if the path is too long. But I am trying to parse it, and depending on the location of the file I want to be able to decide a suitable action while building (writing building scripts) Is there a flag that I am missing, I read the manual pages and can't seem to find anything. Thanks for your help.
I'm going to assume here that you've just done the merge, so I can refer to it as HEAD
.
The automatic output of git merge is essentially git diff-tree --stat -c HEAD
. (Or maybe git diff --stat HEAD^ HEAD
; they're pretty much the same, and it's a call inside the git source, so six of one, half dozen of the other.) The --stat
option gives you that "pretty" output. If you want to get the full information, the quickest way is:
git diff-tree -c --numstat HEAD
# or git diff --numstat HEAD^ HEAD
The first column is the number of added lines, the second is the number of deleted lines, and the third is the full filename.
If the merge is a ways back in the history, just replace HEAD with the appropriate SHA1. If the merge is in progress, and you're examining the merge you're about to commit (after having resolved conflicts, say), use git diff --numstat --cached
.
精彩评论