git-diff: fix missing --merge-base docs
When `git diff --merge-base` was introduced at around Git 2.30, the documentation included a few errors. In the example given for `git diff --cached --merge-base`, the `--cached` flag was omitted for the `--merge-base` example. Add the missing flag. In the `git diff <commit>` case, we failed to mention that `--merge-base` is an available option. Give the usage of `--merge-base` as an option there. Finally, there are two errors in the usage of `git diff`. Firstly, we do not mention `--merge-base` in the `git diff --cached` case. Mention it so that it's consistent with the documentation. Secondly, we put the `[--merge-base]` in between `<commit>` and `[<commit>...]`. Move the `[--merge-base]` so that it's beside `[<options>]` which is a more logical grouping. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
cce7d6ecfc
commit
eb448631fb
@ -51,16 +51,20 @@ files on disk.
|
|||||||
--staged is a synonym of --cached.
|
--staged is a synonym of --cached.
|
||||||
+
|
+
|
||||||
If --merge-base is given, instead of using <commit>, use the merge base
|
If --merge-base is given, instead of using <commit>, use the merge base
|
||||||
of <commit> and HEAD. `git diff --merge-base A` is equivalent to
|
of <commit> and HEAD. `git diff --cached --merge-base A` is equivalent to
|
||||||
`git diff $(git merge-base A HEAD)`.
|
`git diff --cached $(git merge-base A HEAD)`.
|
||||||
|
|
||||||
'git diff' [<options>] <commit> [--] [<path>...]::
|
'git diff' [<options>] [--merge-base] <commit> [--] [<path>...]::
|
||||||
|
|
||||||
This form is to view the changes you have in your
|
This form is to view the changes you have in your
|
||||||
working tree relative to the named <commit>. You can
|
working tree relative to the named <commit>. You can
|
||||||
use HEAD to compare it with the latest commit, or a
|
use HEAD to compare it with the latest commit, or a
|
||||||
branch name to compare with the tip of a different
|
branch name to compare with the tip of a different
|
||||||
branch.
|
branch.
|
||||||
|
+
|
||||||
|
If --merge-base is given, instead of using <commit>, use the merge base
|
||||||
|
of <commit> and HEAD. `git diff --merge-base A` is equivalent to
|
||||||
|
`git diff $(git merge-base A HEAD)`.
|
||||||
|
|
||||||
'git diff' [<options>] [--merge-base] <commit> <commit> [--] [<path>...]::
|
'git diff' [<options>] [--merge-base] <commit> <commit> [--] [<path>...]::
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
static const char builtin_diff_usage[] =
|
static const char builtin_diff_usage[] =
|
||||||
"git diff [<options>] [<commit>] [--] [<path>...]\n"
|
"git diff [<options>] [<commit>] [--] [<path>...]\n"
|
||||||
" or: git diff [<options>] --cached [<commit>] [--] [<path>...]\n"
|
" or: git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]\n"
|
||||||
" or: git diff [<options>] <commit> [--merge-base] [<commit>...] <commit> [--] [<path>...]\n"
|
" or: git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]\n"
|
||||||
" or: git diff [<options>] <commit>...<commit>] [--] [<path>...]\n"
|
" or: git diff [<options>] <commit>...<commit>] [--] [<path>...]\n"
|
||||||
" or: git diff [<options>] <blob> <blob>]\n"
|
" or: git diff [<options>] <blob> <blob>]\n"
|
||||||
" or: git diff [<options>] --no-index [--] <path> <path>]\n"
|
" or: git diff [<options>] --no-index [--] <path> <path>]\n"
|
||||||
|
Reference in New Issue
Block a user