简体   繁体   English

Git:取消跟踪文件而不删除 git 缓存

[英]Git : Untrack files without remove git cache

I try to ignore a folder with git update-index --skip-worktree command, but it cant mark to S (skip-worktree) files under the folder until i remove git cache.我尝试使用git update-index --skip-worktree命令忽略文件夹,但在我删除 git 缓存之前,它无法标记文件夹下的S (skip-worktree)文件。 git rm -r --cached

When i check files with git ls-files -v all of them still mark with H .当我使用git ls-files -v检查文件时,所有这些文件仍然用H标记。 If i remove git cahce, this time, it removes all files from local which are need to be mark S, and files wait in stage to commit.如果我删除 git cahce,这一次,它会从本地删除所有需要标记为 S 的文件,并且文件在阶段等待提交。

I try to gitignore_global but same thing is happen.我尝试gitignore_global但同样的事情发生了。 I need untrack the folder directory without removing cache or push anything to remote.我需要在不删除缓存或将任何内容推送到远程的情况下取消跟踪文件夹目录。 Is it possible?是否可以?

It sounds like what you want to do is ignore tracked files, and as the Git FAQ mentions , Git has no way to do that.听起来您想要做的是忽略跟踪文件,正如 Git FAQ 提到的那样,Git 无法做到这一点。 git update-index is specifically mentioned by the FAQ as not working for that purpose.常见问题解答特别提到git update-index不适用于该目的。

If you have build files, they shouldn't be checked into the repository.如果您有构建文件,则不应将它们签入存储库。 Git is not an asset store, and not checking build files into the repository will prevent them from being modified when you rebuild. Git 不是资产商店,不将构建文件检入存储库将防止它们在重建时被修改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM