简体   繁体   English

git diff无法处理跟踪文件中的未暂存更改

[英]git diff not working on unstaged changes in tracked files

I have two machines, one with git 1.7.0.4, and the other with 1.7.12.4 (Apple Git-37). 我有两台机器,一台使用git 1.7.0.4,另一台使用1.7.12.4(Apple Git-37)。

I've modified a file in the tree on each machine (the same change, the same file, but located on two different computers) but have not staged it yet on either. 我已经在每台计算机上的树中修改了一个文件(相同的更改,相同的文件,但是位于两台不同的计算机上),但是尚未在任何一个上暂存。

# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   Rakefile
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   Hs-At_AND/

(The displays are slightly different for the two versions of git. I'm only showing the 1.7.12.4 display.) (两个版本的git的显示略有不同。我只显示1.7.12.4的显示。)

On 1.7.12.4 (on my Mac), git diff Rakefile shows me the changes in Rakefile relative to the repo version. 在1.7.12.4(在我的Mac上)上, git diff Rakefile向我显示Rakefile中相对于回购版本的更改。

But on the other, git diff Rakefile does nothing. 但另一方面, git diff Rakefile不执行任何操作。 There's no output, no error message. 没有输出,没有错误消息。

There are other similar- looking questions on StackOverflow (eg, git diff gives no output ), but these all seem to be asking about untracked files. 还有StackOverflow上其他similar- 前瞻性的问题(例如, git的差异不会有任何输出 ),但这些似乎都询问未跟踪文件。 My question is regarding tracked-but-not-yet-staged files. 我的问题是关于跟踪但尚未暂存的文件。

Obviously I'm not doing anything wrong here. 显然,我在这里没有做错任何事情。 What's wrong with my installation, then? 那么,我的安装有什么问题? Is there something I can change in my .gitconfig ? 我可以在.gitconfig进行更改吗?

Since it's on two different machines, you are possibly running the command on two different physical devices, only one of which contains the changed file. 由于该命令位于两台不同的计算机上,因此您可能在两个不同的物理设备上运行该命令,其中只有一个包含更改的文件。

File changes are machine-local (unless you use a shared/remote file system) until you have committed and pushed changes. 在您提交并推送更改之前,文件更改是本地计算机的(除非您使用共享/远程文件系统)。 Other machines won't see the local changes until they have fetched/pulled the updated repo. 其他计算机在获取/拉动更新的存储库之前,将看不到本地更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM