如何恢复默认设置或使用UI工具进行git diff?

3

我正在使用Ubuntu 14.04,在推送代码之前,我通常会运行git diff命令来了解我在代码中所做的更改。

后来有人告诉我,我应该使用meld来解决合并冲突。

由于meld过于复杂,我现在无法解决任何冲突,也无法再使用git diff了。因此,我想恢复旧的git diff。

当我运行git diff时,会出现以下错误。

Usage: 
  meld                        Start with an empty window
  meld <file|dir>             Start a version control comparison
  meld <file> <file> [<file>] Start a 2- or 3-way file comparison
  meld <dir> <dir> [<dir>]    Start a 2- or 3-way directory comparison
  meld <file> <dir>           Start a comparison between file and dir/file

meld: error: too many arguments (wanted 0-3, got 7)
external diff died, stopping at app/Plugin/Community/Controller/CommunitiesContr

我只想看到我编辑后的代码与原始代码的区别,这样我就可以在推送之前验证更改。

你解决了吗? - Stefan Falk
不行,还在寻找答案.. 是否可以使用git diff? - user1735921
1个回答

1
你尝试过使用 git difftool 命令吗?
git difftool --tool=meld yourfile

我找到了一个这里的答案,描述了如何配置difftool以使用meld作为默认工具。

简而言之:

  1. Open your git configuration file (usually ~/.gitconfig on linux)
  2. and enter the following sections:

    [diff]
      tool = meld
    [difftool]
      prompt = false
    [difftool "meld"]
      cmd = meld "$LOCAL" "$REMOTE"
    
  3. Now you can call git difftool yourfile

上面的链接还描述了如何将meld配置为默认的合并工具。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接