Skip to content

Commit 4431c94

Browse files
committed
Preserve information on use of git-external-diff
Now that the Working with git wiki page no longer suggests producing context diffs, we should preserve the information on how to use git-external-diff for those people who want to view context format diffs. The most obvious place is in the script itself, so that's what's done here.
1 parent 0c7e6b7 commit 4431c94

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/tools/git-external-diff

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,41 @@
77
# path old-file old-hash old-mode new-file new-hash new-mode
88
# 'path' is the git-tree-relative path of the file being diff'ed
99

10+
=comment
11+
12+
This info is copied from the old wiki page on Working with git:
13+
14+
Context diffs with Git
15+
16+
Copy git-external-diff into libexec/git-core/ of your git installation
17+
and configure git to use that wrapper with:
18+
19+
git config [--global] diff.external git-external-diff
20+
21+
--global makes the configuration global for your user - otherwise it is
22+
just configured for the current repository.
23+
24+
For every command which displays diffs in some way you can use the
25+
parameter "--[no-]-ext-diff" to enable respectively disable using the
26+
external diff command.
27+
28+
For the git diff command --ext-diff is enabled by default - for any
29+
other command like git log -p or git format-patch it is not!
30+
31+
This method should work on all platforms supported by git.
32+
33+
If you do not want to configure the external wrapper permanently or you
34+
want to overwrite it you can also invoke git like:
35+
36+
export GIT_EXTERNAL_DIFF=git-external-diff
37+
git diff --[no-]ext-diff
38+
39+
Alternatively, configure a git alias in ~/.gitconfig or .git/config:
40+
41+
[alias]
42+
cdiff = !GIT_EXTERNAL_DIFF=git-context-diff git diff
43+
=cut
44+
1045
old_hash="$3"
1146
new_hash=$(git hash-object "$5")
1247

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy