How does "index f2e4113..d4b9bfc 100644" in git diff correspond to SHA1 ID in gitk? -
what 'index f2e4113..d4b9bfc 100644' mean in output git diff? till have assumed these sha1 id's from_version..to_version, can't find them in gitk.
$ git --version git version 1.8.3.4 $ git diff ae1fdc1 diff --git a/readme b/readme index f2e4113..d4b9bfc 100644 --- a/readme +++ b/readme @@ -1 +1,3 @@ stuff +more +more stuff
'index f2e4113..d4b9bfc 100644' doesn't part of diff unified format. http://en.wikipedia.org/wiki/diff#unified_format
100644 looks file mode, doesn't correspond mode of readme file (660).
f2e4113..d4b9bfc sha1 id shorties. 'git rev-parse ' gives long sha1. here 3 shorties example above:
ae1fdc1 - ae1fdc1e7b2f018a15c421f2f22b7c77215c5d61 d4b9bfc - d4b9bfcd51a3eaf427d337a30b12d1f3dbdd21b4 f2e4113 - f2e41136eac73c39554dede1fd7e67b12502d577
but why doesn't ae1fdc1 correspond first or second part of diff? , why can't find d4b9bfc or d4b9bfc using gitk?
edit: @wiswit has pointed this explanation.
f2e4113
, d4b9bfc
file-indexes. git show f2e4113
see file before commit , git show d4b9bfc
shows file after commit.
the combined diff format in git diff manual pages described.
combined diff format diff-generating command can take ‘-c` or --cc option produce combined diff when showing merge. default format when showing merges git-diff(1) or git-show(1). note can give `-m’ option of these commands force generation of diffs individual parents of merge. combined diff format looks this: diff --combined describe.c index fabadb8,cc95eb0..4866510 --- a/describe.c +++ b/describe.c @@@ -98,20 -98,12 +98,20 @@@ return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1; } - static void describe(char *arg) -static void describe(struct commit *cmit, int last_one) ++static void describe(char *arg, int last_one) { + unsigned char sha1[20]; + struct commit *cmit; struct commit_list *list; static int initialized = 0; struct commit_name *n; + if (get_sha1(arg, sha1) < 0) + usage(describe_usage); + cmit = lookup_commit_reference(sha1); + if (!cmit) + usage(describe_usage); + if (!initialized) { initialized = 1; for_each_ref(get_name); 1. preceded "git diff" header, looks (when -c option used): diff --combined file or (when --cc option used): diff --cc file 2. followed 1 or more extended header lines (this example shows merge 2 parents): index <hash>,<hash>..<hash> mode <mode>,<mode>..<mode> new file mode <mode> deleted file mode <mode>,<mode> mode <mode>,<mode>..<mode> line appears if @ least 1 of <mode> different rest. extended headers information detected contents movement (renames , copying detection) designed work diff of 2 <tree-ish> , not used combined diff format. 3. followed two-line from-file/to-file header --- a/file +++ b/file similar two-line header traditional unified diff format, /dev/null used signal created or deleted files. 4. chunk header format modified prevent people accidentally feeding patch -p1. combined diff format created review of merge commit changes, , not meant apply. change similar change in extended index header: @@@ <from-file-range> <from-file-range> <to-file-range> @@@ there (number of parents + 1) @ characters in chunk header combined diff format. unlike traditional unified diff format, shows 2 files , b single column has - (minus — appears in removed in b), + (plus — missing in added b), or " " (space — unchanged) prefix, format compares 2 or more files file1, file2,... 1 file x, , shows how x differs each of filen. 1 column each of filen prepended output line note how x’s line different it. - character in column n means line appears in filen not appear in result. + character in column n means line appears in result, , filen not have line (in other words, line added, point of view of parent). in above example output, function signature changed both files (hence 2 - removals both file1 , file2, plus ++ mean 1 line added not appear in either file1 nor file2). 8 other lines same file1 not appear in file2 (hence prefixed +). when shown git diff-tree -c, compares parents of merge commit merge result (i.e. file1..filen parents). when shown git diff-files -c, compares 2 unresolved merge parents working tree file (i.e. file1 stage 2 aka "our version", file2 stage 3 aka "their version").
Comments
Post a Comment