我现在遇到了一个存储库问题,虽然我的git-fu通常很好,但我似乎无法解决这个问题.
当我克隆这个存储库,然后cd进入repo时,git-status会显示几个已更改的文件.注意:我没有在任何编辑器或任何东西中打开回购.
我尝试按照本指南:http://help.github.com/dealing-with-lineendings/但这对我的问题没有任何帮助.
我尝试了cd
很多次,但似乎没有做任何事情.
任何帮助/想法将不胜感激
更新1:我在Mac上,并且repo本身没有子模块.
更新2:文件系统是mac上的"Journaled HFS +"文件系统,不区分大小写.这些文件是一行的,每个大约79K(是的,你听到了),所以看看git status
并不是特别有用.我听说过git checkout -- .
这可能会有所帮助,当我回到计算机上时,我会尝试使用它.
更新3:用事实更改文件系统的细节!而且,我尝试了git diff
一些效果不佳的技巧.
我已经阅读了一些关于Git文件权限的问题,我仍然有点困惑.我在GitHub上有一个来自另一个的回购.合并后,它们应该是相同的.然而:
$ git diff --summary origin/epsilon master/epsilon
mode change 100644 => 100755 ants/dist/sample_bots/csharp/compile.sh
mode change 100644 => 100755 ants/dist/starter_bots/coffeescript/MyBot.coffee
mode change 100644 => 100755 ants/dist/starter_bots/coffeescript/ants.coffee
mode change 100644 => 100755 ants/util/block_test.sh
mode change 100644 => 100755 manager/mass_skill_update.py
mode change 100644 => 100755 worker/jailguard.py
mode change 100644 => 100755 worker/release_stale_jails.py
mode change 100644 => 100755 worker/start_worker.sh
Run Code Online (Sandbox Code Playgroud)
我已经尝试更改文件权限,但它不会改变差异结果.
我已经看过所有类似的问题但是我已经仔细检查了一些奇怪的东西肯定会发生.
在一台服务器(Solaris with git 1.8.1)上,我克隆了git存储库,然后将.git文件夹复制到现有的实时文件中.这很完美,我可以跑
git status
Run Code Online (Sandbox Code Playgroud)
然后
git diff [filename]
Run Code Online (Sandbox Code Playgroud)
检查任何不同的文件.
在另一台服务器(Solaris with git 1.7.6)上,我做的完全一样
git diff [filename]
Run Code Online (Sandbox Code Playgroud)
即使文件的内容肯定不同,也不显示任何内容.我还测试了添加一个新文件,然后进行编辑.同样的问题,git status
将文件显示为已更改但未git diff
显示任何内容.如果我下载更改的文件并在本地运行diff,那么我得到diff输出.
从命令行看到以下内容后:
# On branch RB_3.0.10
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: index.htm
Run Code Online (Sandbox Code Playgroud)
我试图通过键入命令来放弃我的更改:
git checkout -- index.htm
Run Code Online (Sandbox Code Playgroud)
但是当我重新运行git status时,它看起来完全一样.结帐似乎不起作用.难道我做错了什么?我在windows/cygwin上使用GIT 1.6.1.2.
# On branch RB_3.0.10
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: …
Run Code Online (Sandbox Code Playgroud) 我有一个repo,有两个文件,据说我在本地更改.
所以我坚持这个:
$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: dir1/foo.aspx
# modified: dir2/foo.aspx
#
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
做了git diff
说整个文件内容已经改变了,即使从眼球看起来似乎是不真实的(似乎有差异的共同行范围似乎没有看到).
有趣的是我不记得在本地更改这些文件.此仓库与一个远程仓库(私人,GitHub.com,FWIW)一起使用.
无论我尝试过什么,我都不能放弃这些局部变化.我尝试了所有:
$ git checkout -- .
$ git checkout -f
$ git checkout -- dir1/checkout_receipt.aspx
$ git reset …
Run Code Online (Sandbox Code Playgroud) 我无意中更改了整个树的权限,并单独提交更改以及其他内容更改.
我使用类似的东西:
tar -czf deploy.tar git diff --name-only v1 v2
Run Code Online (Sandbox Code Playgroud)
使用两个标签之间的修改文件生成tar,问题是现在因为权限更改几乎所有我的树都被列为已修改.
有没有办法让我git diff
忽略那些只更改权限的文件?
我试过了
git diff 13.1_dev sale_edit > patch.diff
Run Code Online (Sandbox Code Playgroud)
然后我尝试git apply patch.diff
在另一个分支,但我得到补丁不适用.如何从差异中创建补丁文件,我可以使用git apply?
收到的错误:
$ git apply --ignore-space-change --ignore-whitespace diff.diff
diff.diff:9: trailing whitespace.
diff.diff:10: trailing whitespace.
function set_change_sale_date()
diff.diff:12: space before tab in indent.
$this->sale_lib->set_change_sale_date($this->input->post('change_sale_date'));
diff.diff:14: trailing whitespace.
diff.diff:15: trailing whitespace.
function set_change_sale_date_enable()
warning: application/controllers/sales.php has type 100755, expected 100644
error: patch failed: application/controllers/sales.php:520
error: application/controllers/sales.php: patch does not apply
warning: application/language/english/sales_lang.php has type 100755, expected 100644
error: patch failed: application/language/english/sales_lang.php:134
error: application/language/english/sales_lang.php: patch does not apply
warning: application/libraries/Sale_lib.php has …
Run Code Online (Sandbox Code Playgroud) 我正在尝试查看未分阶段的单个文件的更改.
首先我git status
用来查看所有未分级的更改
然后例如:
git diff AndroidManifest.xml
Run Code Online (Sandbox Code Playgroud)
但我得到了这个输出
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
old mode 100755
new mode 100644
Run Code Online (Sandbox Code Playgroud)
这意味着什么以及如何查看特定文件的更改
我有一个相反的问题," 如何使Git忽略文件模式(chmod)更改? "我有一个文件,我已经更改了可执行权限,但也有一些文本更改,我想承诺前者但不承认后者.这可能与git有关吗?
(实际上,我做了一些文本更改,我想提交可执行权限更改,以及其他我不想提交)
更新:将文本更改取消暂存到文件,然后git add -p
再次执行并合并一些文本更改,以便将模式更改为暂存.(我的git版本是1.5.4.3)
这是一个Linux 2.6内核存储库.我把它克隆到我的本地主机.
之后.我没有做任何改变.但是当我"git status".我找到了13个修改过的文件 我想丢弃它们,但我不能.
> luke@Macbook-Pro~/Documents/workspace/linuxkernel/linux-2.6$ git
> status
> # 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: include/linux/netfilter/xt_connmark.h
> # modified: include/linux/netfilter/xt_dscp.h
> # modified: include/linux/netfilter/xt_mark.h
> # modified: include/linux/netfilter/xt_rateest.h
> # modified: include/linux/netfilter/xt_tcpmss.h
> # modified: include/linux/netfilter_ipv4/ipt_ecn.h
> # modified: include/linux/netfilter_ipv4/ipt_ttl.h
> # modified: …
Run Code Online (Sandbox Code Playgroud)