I previously changed my git diff tool with git config --global diff.external <diff-tool-name>
. I decided I don't like that tool and wanted to switch back.
I tried meddling around and did something like: git config --global diff.external git-diff
. Now calling git diff
to see unstaged changes yields:
fatal: ambiguous argument '48e66b706d21398f28240810e7fc0d44d8f92d99': unknown revision or path not in the working tr Use '--' to separate paths from revisions external diff died, stopping at somefile.ext.
How do I set my git diff
command to use the default command line git diff that came with git. Something like:
git config --global diff.
and then what?
By default git diff will execute the comparison against HEAD . Omitting HEAD in the example above git diff ./path/to/file has the same effect. When git diff is invoked with the --cached option the diff will compare the staged changes with the local repository.
Git diff is a command-line utility. It's a multiuse Git command. When it is executed, it runs a diff function on Git data sources. These data sources can be files, branches, commits, and more.
In most cases, Git picks A and B in such a way that you can think of A/- as "old" content and B/+ as "new" content. Let's look at our example: Change #1 contains two lines prepended with a "+". Since no counterpart in A existed for these lines (no lines with "-"), this means that these lines were added.
According to the official Git documentation, git diff is used to: “Show changes between the working tree and the index or a tree, changes between the index and a tree, changes between two trees, changes resulting from a merge, changes between two blob objects, or changes between two files on disk.”
Trygit config --global --unset diff
and
git config --global --unset diff.external
See the explanation of git config
for further details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With