by
Anonymous Coward
on 2012年09月16日 7時41分
(#2232761)
$ patch --version GNU patch 2.7 Copyright (C) 2003, 2009-2012 Free Software Foundation, Inc. Copyright (C) 1988 Larry Wall
License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Written by Larry Wall and Paul Eggert
$ diff --version diff (GNU diffutils) 3.2 Packaged by Gentoo (3.2) Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Written by Paul Eggert, Mike Haertel, David Hayes, Richard Stallman, and Len Tower.
GENERATING PATCHES WITH -P When "git-diff-index", "git-diff-tree", or "git-diff-files" are run with a -p option, "git diff" without the --raw option, or "git log" with the "-p" option, they do not produce the output described above; instead they produce a patch file. You can customize the creation of such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.
What the -p option produces is slightly different from the traditional diff format:
1. It is preceded with a "git diff" header that looks like this:
diff --git a/file1 b/file2
The a/ and b/ filenames are the same unless rename/copy is involved. Especially, even for a creation or a deletion, /dev/null is not used in place of the a/ or b/ filenames.
When rename/copy is involved, file1 and file2 show the name of the source file of the rename/copy and the name of the file that rename/copy produces, respectively.
わけがわからない (スコア:0)
$ patch --version
GNU patch 2.7
Copyright (C) 2003, 2009-2012 Free Software Foundation, Inc.
Copyright (C) 1988 Larry Wall
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Larry Wall and Paul Eggert
$ diff --version
diff (GNU diffutils) 3.2
Packaged by Gentoo (3.2)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.
な環境だけど、自分もまたdiff --gitなんて使ったことが無かったのでどういうものかと思い調べてるんだが。
そもそもman diffやman patchしてgitを探しても、diff --help |grep gitやpatch --help |grep gitして探しても
degitがヒットするくらいでgitという単語自体が無い。
ドキュメントとしては存在しないけど、スイッチで指定すれば実は使える系の類かと思いやってみても
$ diff --git hogehoge fugafuga
diff: unrecognized option '--git'
diff: Try `diff --help' for more information.
とつれない返事。
全くわけがわからない、diff --gitじゃなくてgit-diffのことなんだろうか……
だけど公式のリリースニュース文 [gnu.org]ですら“git --diff”って書いてるしなあ……
Re:わけがわからない (スコア:1)
git-diffの出力の頭についてるところから"diff --git"フォーマットと呼んでるのかも知れませんね。まあgit使ってない…使ってもソースもらってくるくらいなので私には縁が無さそうです(汗)。