git结帐。添加稀疏结帐排除的目录 [英] git checkout . adds directories excluded by sparse checkout

查看:98
本文介绍了git结帐。添加稀疏结帐排除的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个稀疏的结账场景中,命令 git checkout。会恢复应该忽略的目录。这是设计,还是Git中的潜在问题?我正在使用 git checkout。放弃我对工作副本所做的任何更改 - 是否有另一个命令会执行相同的操作并且不会遇到此问题?



以下是一个可重现的例子:

  rm -rf test 
git init测试
cd测试
for abc; do
mkdir $ f
touch $ f / $ f
git add $ f / $ f
git commit -madded $ f
done
git config core.sparsecheckout true
echo a> .git / info / sparse-checkout
echo b>> .git / info / sparse-checkout
git read-tree -m -u HEAD
ls




  ab 


到目前为止,这么好。问题出在这里:

  git checkout。 
ls




  abc 


顺便说一句:

  git --version 




  git版本1.7.10.4 


问题为什么排除文件继续出现在我的git sparse checkout中?是相关的,但更老,并且不能很好地描述我所看到的内容。 方案

这不是设计。该行为在更改。 gmane.org/gmane.comp.version-control.git/224297rel =nofollow> Git 1.8.3 。


In a sparse checkout scenario, the command git checkout . restores the directories that should be ignored. Is this by design, or a potential problem in Git? I’m using git checkout . to discard any changes I’ve made to my working copy -- is there another command that will do the same and not suffer from this problem?

Here’s a reproducible example:

rm -rf test
git init test
cd test
for f in a b c; do
  mkdir $f
  touch $f/$f
  git add $f/$f
  git commit -m "added $f"
done
git config core.sparsecheckout true
echo a > .git/info/sparse-checkout
echo b >> .git/info/sparse-checkout
git read-tree -m -u HEAD
ls

a b

So far, so good. Here's the problem:

git checkout .
ls

a b c

By the way:

git --version

git version 1.7.10.4

The question Why do excluded files keep reappearing in my git sparse checkout? is related, but much older and doesn’t quite describe what I’m seeing.

解决方案

It's not by design. The behavior has changed in Git 1.8.3.

这篇关于git结帐。添加稀疏结帐排除的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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