相关疑难解决方法(0)

Git状态 - 有没有办法只在特定目录中显示更改?

我希望看到自上次提交以来修改的文件列表,如图git status所示,但我只关心位于单个目录中的文件.有没有办法做到这一点?我尝试过git status <directory>,但似乎这完全不同(列出所有更改过的文件,就像我git add <directory>先写的那样).

git-status的文档并没有说明多少,除了它接受git-commit所做的相同选项(但git-commit的目的不是显示已更改文件的列表).

git directory status

131
推荐指数
3
解决办法
7万
查看次数

如何在Git中规范化工作树行结尾?

我克隆了一个存在不一致行结尾的存储库.我添加了一个.gitattributes为我想要规范化的文件设置text属性.现在,当我提交更改时,我收到消息:

warning: CRLF will be replaced by LF in FILE.
The file will have its original line endings in your working directory.
Run Code Online (Sandbox Code Playgroud)

如何让git为我标准化我的文件的工作副本?我希望git能够规范化整个工作树.

git line-endings gitattributes

57
推荐指数
3
解决办法
2万
查看次数

如何在git diff命令中显示相对路径?

它以这种方式工作:

MYPC /d/home/project/some/path (master)
$ git diff --name-only --cached
root.txt
some/path/relative.txt
Run Code Online (Sandbox Code Playgroud)

即它显示了来自GIT根目录的路径,但是我需要来自当前目录的相对路径。

预期结果 :

$ git diff --name-only --cached --AND_SOME_OPTION
../../root.txt
relative.txt
Run Code Online (Sandbox Code Playgroud)

按照常识,它应该像一样工作git status

PS--relative选项不起作用,因为它将显示该目录中的文件。在我们的示例中,它将仅显示relative.txt

PPS

使用--git-dir效果不佳:

$ git --git-dir=$(git rev-parse --show-toplevel)/.git  diff --cached --name-only
root.txt
some/path/relative.txt
Run Code Online (Sandbox Code Playgroud)

git git-diff

4
推荐指数
1
解决办法
1405
查看次数

标签 统计

git ×3

directory ×1

git-diff ×1

gitattributes ×1

line-endings ×1

status ×1