git - 如何让我的 git 集成 Kaleidoscope 显示所有即将提交的文件?

标签 git diff

我正在使用命令行 git 和 Kaleidoscope执行我的代码审查。当我将一个分支 merge 到另一个分支并输入

git difftool

Kaleidoscope 仅显示“未准备提交”的更改,不显示“未 merge 的路径”或“更改为提交”。

命令行显示其余内容。

知道为什么吗?

这是我的.gitconfig的相关内容

[difftool "Kaleidoscope"]
        cmd = ksdiff-wrapper git \"$LOCAL\" \"$REMOTE\"
[diff]
        tool = Kaleidoscope
[difftool]
        prompt = false

最佳答案

简短回答:您希望在命令行中输入的是 git difftool HEAD,而不是 git difftool

长答案:这是正常的 git 行为,如果您没有意识到正在发生的事情,那会有点令人沮丧。我不确定为什么命令行 diff 会像您预期的那样工作,但是 git diffgit difftool 的表现应该与 git 手册页相似:

git diff [--options] [--] [<path>...] This form is to view the changes you made relative to the index (staging area for the next commit). In other words, the differences are what you could tell git to further add to the index but you still haven't. You can stage these changes by using git-add(1).

因此 git diffgit difftool 应该只显示未暂存 更改。

如果你想看到staged 变化,你应该使用git diff --cachedgit difftool --cached:

git diff [--options] --cached [<commit>] [--] [<path>...] This form is to view the changes you staged for the next commit relative to the named <commit>. Typically you would want comparison with the latest commit, so if you do not give <commit>, it defaults to HEAD. If HEAD does not exist (e.g. unborned branches) and <commit> is not given, it shows all staged changes. --staged is a synonym of --cached.

最后,如果您想查看暂存和未暂存 更改,请使用第三种形式,git diff HEADgit difftool HEAD :

git diff [--options] <commit> [--] [<path>...] This form is to view the changes you have in your working tree relative to the named <commit>. You can use HEAD to compare it with the latest commit, or a branch name to compare with the tip of a different branch.

关于git - 如何让我的 git 集成 Kaleidoscope 显示所有即将提交的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11764148/

相关文章:

git - 如何通过ssh将git repo推送到远程服务器?

linux - 使用 svn diff 命令

diff - 忽略换行符/多行差异/回流忽略差异

linux - 从文件列表创建 .new 文件

javascript - Google-diff-match 避免显示新行?

git - 什么时候 2 个补丁在 git 中被认为是相等的?

git - Linus Torvalds 说 Git "never ever"跟踪一个文件是什么意思?

git - 使用 git 提交强制执行经过身份验证的用户名(在本例中为 Gitlab)

php - 使用差异/补丁合并 PHP 更改

java - 当为 JComponent 使用本地文件时,有没有办法不对文件路径进行硬编码?