git藏匿修改文件? [英] git stash leaving modified files?

查看:210
本文介绍了git藏匿修改文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试隐藏更改时,我得到一些奇怪的行为.我不是git专家,所以我希望有人可以对此有所了解:

I'm getting some odd behavior when trying to stash changes. I'm not a git expert so I'm hoping someone can shed some light on this:

  1. 在最新的分支上,我修改了一个跟踪文件. git status显示为已修改
  2. git stash(响应保存的工作目录和WIP处于索引状态……)
  3. git状态仍然显示文件已修改,但是git diff(和git gui)未显示任何更改.
  4. git隐藏列表显示隐藏已创建
  5. git stash pop响应为错误:对以下文件的本地更改将被合并所覆盖:"

3的行为对我来说毫无意义.它是最近才开始发生的.我已经使用隐藏/隐藏弹出功能好几个月了.

The behavior at 3 makes no sense to me. It started happening fairly recently. I've been using stash/stash pop for several months with no problems.

我想知道我的本地工作副本是否存在问题,因此我重新克隆后却得到了相同的行为.

I wondered whether there was an issue with my local working copy so I re-cloned but get the same behavior.

我的GIT安装是否已损坏,或者我丢失了某些东西?

Is my GIT installation broken, or am I missing something?

其他信息:

  • 在另一台PC上进行了尝试,其行为符合预期,因此与该安装有关.

  • Tried this on another PC and it behaves as expected, so it's something to do with this installation.

尝试创建新的本地仓库,添加&提交1个文件,修改,保存.相同的行为

Tried creating a new local repo, add & commit 1 file, modify, stash. Same behavior

尝试使用CR LF和LF行尾的文件.相同的行为

Tried with files with CR LF and LF line endings. Same behavior

git config -l:

git config -l:

core.symlinks=true
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
diff.astextplain.textconv=astextplain
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
core.editor='C:\Program Files (x86)\Notepad++\notepad++.exe' -multiInst -    notabbar -nosession -noPlugin
core.excludesfile=C:\GIT\gitignore\VisualStudio.gitignore
core.editor=notepad
core.fscache=true
core.preloadindex=true
gui.fontdiff=-family Consolas -size 10 -weight normal -slant roman -    underline 0 -overstrike 0
gui.recentrepo=C:/GIT/polarisv4
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
user.name=xxxxx
user.email=xxxxxx
difftool.sourcetree.cmd='C:/Program     Files/TortoiseGit/bin/TortoiseGitMerge.exe' "$LOCAL" "$REMOTE"
mergetool.sourcetree.cmd='C:/Program     Files/TortoiseGit/bin/TortoiseGitMerge.exe'  -base:"$BASE" -mine:"$LOCAL" -    theirs:"$REMOTE" -merged:"$MERGED"
mergetool.sourcetree.trustexitcode=true
alias.co=checkout
alias.br=branch
alias.st=status
winupdater.recentlyseenversion=2.15.1.windows.2
credential.helper=manager
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.ignorecase=true

推荐答案

正如DaveW所说的那样,问题出在core.fscache=true设置上.这是仅Windows的设置,该设置启用文件系统缓存,以减轻某些Windows文件系统操作的速度.这是从提交消息中提取的描述 Win32:在mingw的lstat和以下添加一个缓存不同的实现:

As DaveW said the problem comes from the core.fscache=true setting. This is a Windows only setting that enable a file system cache in order to mitigate slowness of some Windows file system operations. Here is the description extracted from the commit message Win32: add a cache below mingw's lstat and dirent implementations:

由于速度较慢,因此在Windows上检查工作树状态的速度相当慢 lstat仿真(git对索引中的每个文件调用一次lstat). Windows操作系统API在扫描以下内容方面似乎更好. 整个目录的状态,而不是检查单个文件.

Checking the work tree status is quite slow on Windows, due to slow lstat emulation (git calls lstat once for each file in the index). Windows operating system APIs seem to be much better at scanning the status of entire directories than checking single files.

添加一个使用lstat数据缓存的lstat实现.快取 未命中会读取整个父目录并将其添加到缓存中. 对同一目录的后续lstat调用直接从提供 缓存.

Add an lstat implementation that uses a cache for lstat data. Cache misses read the entire parent directory and add it to the cache. Subsequent lstat calls for the same directory are served directly from the cache.

还实现opendir/readdir/closedir,以便它们创建并 在缓存中使用目录列表.

Also implement opendir / readdir / closedir so that they create and use directory listings in the cache.

缓存不跟踪文件系统更改,也不会插入任何文件 修改文件API,因此必须为git显式启用它 不会修改工作副本的功能.

The cache doesn't track file system changes and doesn't plug into any modifying file APIs, so it has to be explicitly enabled for git functions that don't modify the working copy.

此提交消息的最后一句话指示了OP问题的原因.

The last sentence of this commit message gives an indication of the cause of the OP problem.

这篇关于git藏匿修改文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆