Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure 'git diff' to use emacs diff [duplicate]

Tags:

git

emacs

Is it possible to configure git diff to use emacs diff? If yes, can you please tell me how?

Thank you.

like image 867
n179911 Avatar asked Aug 03 '09 18:08

n179911


People also ask

How do I use git Difftool?

Go to your repository in Git Bash. Type git config diff. tool winmerge . Verify it worked by typing git difftool .

Which command can be used to configure Vimdiff as the default diff tool for git?

By default, git calls vimdiff with the -R option. You can override it with git config --global difftool. vimdiff. cmd 'vimdiff "$LOCAL" "$REMOTE"'.

How do I view a git diff file?

The diff can be done with git diff (followed by the filename or nothing if you want to see the diff of all modified files). But if you already did something like git add * , you have to undo with git restore --staged .


4 Answers

See this question: how-do-i-view-git-diff-output-with-visual-diff-program for information on git difftool.

You can also use git from within emacs: EmacsWiki: Git.

like image 155
Karl Voigtland Avatar answered Oct 02 '22 21:10

Karl Voigtland


It seems to be possible, according to the Pro Git book.

See chapter 7.1 for more information, but the quick'n'dirty of it seems to be

$ git config --global diff.external [your favorite differ here]

or, if you want it to your ~/.gitconfig

[diff]
  external = [your favorite differ here]
like image 23
Henrik Paul Avatar answered Oct 02 '22 21:10

Henrik Paul


If you are working within Emacs, you could advice vc-git-diff (the function is found in vc-git.el for reference), to give you the option of using either git-diff or emacs-diff according to your whim (and it wouldn't require you "forking" the git library that comes bundled with Emacs).

like image 45
Pinochle Avatar answered Oct 02 '22 21:10

Pinochle


Assuming you mean git-diff, not git-difftool, you are probably looking for the diff.external config option. You'll want to look at the git Diffs section of git(1). This section doesn't mention the config setting, though it's listed in git-config(1).

like image 32
Cascabel Avatar answered Oct 02 '22 23:10

Cascabel