状态返回没有输出

状态返回没有输出

本文介绍了为什么会git日志/状态返回没有输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常旧的git仓库(大约六岁),并且注意到我没有看到我在 git status 输出中对文件所做的更改。



我在特定文件上运行命令:

  $ git status Data / schema.sql 
$

并没有输出!该文件自开始以来一直在回购。另外,如果我检出repo到另一个目录,这个文件(奇怪的是)出现在那里。

我看到与 git diff相同的数据/ schema.sql git log Data / schema.sql



通常情况下,这样的事情发生了,它是一个 gitignore 问题。但是即使删除我的 .gitignore 文件也没有改变这种行为。



什么会导致这种行为? p>

解决方案

这个症状有两个可能的诊断:

A不区分大小写强制重命名回历史记录



诊断:



  git ls-files 

搜索大小写不同的路径:

  some / path / foo 
Some / path / bar



解决方案



  git mv -f Some / path / * some / path / 

将所有文件( / * )移动到重命名的路径。现在他们都会有一条路径。



可能的原因



some / path 有几个文件,用路径中的不同字母大小写进行跟踪。对于提供到 git log git status 的错误路径的文件,会导致日志中的某些提交异常输出。



这个bug可以用 git mv -f< path / file>

 <$ c  $ c> git log某些/ path / foo 

日志不会 包含一些在 git mv -f some / path / bar前执行的一些提交。



标有 skip-worktree 的文件假定 - 不变的位



感谢@Zeeker的这个假设。

诊断:



  git ls-files -v | grep -E'^(S | [az])'

有关更多信息,请参阅 git ls-files 文档


I have a very old git repository (about six years old) and noticed that I wasn't seeing changes I'd made to a file in my git status output.

I ran the command on the specific file in question:

$ git status Data/schema.sql
$

and got no output! This file has been in the repo since the beginning. Additionally, if I checkout the repo to another directory, the file (strangely enough) appears there.

I saw the same with git diff Data/schema.sql and git log Data/schema.sql.

Normally, when something like this happens, it's a gitignore problem. But even removing my .gitignore file caused no change in this behavior.

What could cause this behavior?

解决方案

This "symptom" has two possible "diagnoses":

A case-insensitive forced rename back in history

Diagnostics:

git ls-files

Search for paths with different capitalizations:

some/path/foo
Some/path/bar

Solution

git mv -f Some/path/* some/path/

It's important to move all files (/*) to the renamed path. Now they will all have a single path.

Possible cause

There may be a situation when some/path has several files with it, tracked with different letter cases in the path. For such files providing an "incorrect" path to git log or git status results in abscense of some commits in the log output.

This bug is reproduceable with git mv -f <path/file> <PATH/file> on Git 1.9.5 and maybe on newer versions (will check later).

git log Some/path/foo

The log will not contain some commits made before the git mv -f some/path/bar Some/path/bar was executed.

Files marked with a skip-worktree or assume-unchanged bit

Thanks to @Zeeker for this assumption.

Diagnostics:

git ls-files -v | grep -E '^(S|[a-z])'

For additional information take a look at the git ls-files documentation.

这篇关于为什么会git日志/状态返回没有输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 23:59