From: "Олег Самойлов" <splarv@ya.ru>
To: git@vger.kernel.org
Subject: Fix and addition to git-diff
Date: Wed, 30 Oct 2019 12:10:21 +0300 [thread overview]
Message-ID: <232BC77E-F22E-469A-8839-6A1553A75B55@ya.ru> (raw)
Hi all.
This is a small patch with fix and addition to the man git-diff. This fix is obvious mistyping in man, there must be "..." instead of "..".
And I added an example about how this can be used. The reason is:
First, I don't know another reason to use a tree-ish with git diff.
Second, the diff with empty tree is a real problem on what some people looking for solution (for various reasons):
https://stackoverflow.com/questions/14564034/creating-a-git-diff-from-nothing/54946189#54946189
https://stackoverflow.com/questions/9765453/is-gits-semi-secret-empty-tree-object-reliable-and-why-is-there-not-a-symbolic/54945479#54945479
And the solutions are not simple nor obvious. So I think it will be helpful to mention it.
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -77,8 +77,16 @@ two blob objects, or changes between two files on disk.
Just in case you are doing something exotic, it should be
noted that all of the <commit> in the above description, except
-in the last two forms that use ".." notations, can be any
-<tree>.
+in the last form, that use the "\..." notation, can be any
+<tree>. For instance, if you want to make diffs against an empty
+tree, you can create a tag pointing to the empty tree:
+
+'git tag' empty $('git hash-object' -t tree /dev/null)
+
+And use it for the 'git diff', for instance, to check a working tree
+for whitespaces:
+
+'git diff' --check empty
For a more complete list of ways to spell <commit>, see
"SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
reply other threads:[~2019-10-30 9:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=232BC77E-F22E-469A-8839-6A1553A75B55@ya.ru \
--to=splarv@ya.ru \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).