gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 13:05:44 25 4
gpt4 key购买 nike

我正在使用命令行 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com