简体   繁体   English

GIT并忽略现有数据

[英]GIT and ignore existing data

I have a git repository on my NAS. 我的NAS上有一个git存储库。 I use from Windows and Linux SmartGit/Hg for interface with it. 我从Windows和Linux使用SmartGit / Hg与其接口。
I had to took some old repository make in TFS and convert into GIT one, so far so good (difficult procedure but I had success). 到目前为止,我不得不在TFS中使用一些旧的存储库,然后将其转换为GIT,这是一个很好的过程(困难的过程,但是我获得了成功)。 For the new project I can tell GIT (before the first "commit") which directory I want to exclude, however the converted repository automatically put in git some directory that heritace from TFS. 对于新项目,我可以告诉GIT(在第一个“提交”之前)要排除的目录,但是转换后的存储库会自动将git继承的目录放在TFS中。 I suppose that TFS also had all the change of this directory. 我想TFS也对该目录进行了所有更改。

So I thought that I can tell to GIT to ignore this directory but from SmartGit/Hg seems that if a directory/file is committed once I can't put it into ignore directory, so how can I tell to git to ignore for the future that directory? 所以我以为我可以告诉GIT忽略该目录,但是从SmartGit / Hg看来,如果一旦提交了目录/文件,便无法将其放入ignore目录,那么我该如何告诉git将来忽略它该目录?

You need to remove that folder from your index (but not from your disk): 您需要从索引(而不是磁盘)中删除该文件夹:

git rm --cached -r yourFolder

(See " gitignore after commit " and " How to remove a directory in my GitHub repository? ") (请参阅“ gitignoregitignore ”和“ 如何在我的GitHub存储库中删除目录? ”)

Then the .gitignore will be able to ignore the folder. 然后, .gitignore将能够忽略该文件夹。

yourFolder/

You can use a gitignore file. 您可以使用gitignore文件。 Here you can define which directories and files will not commited. 在这里,您可以定义不提交的目录和文件。

Click on the link below: https://help.github.com/articles/ignoring-files/ 单击下面的链接: https : //help.github.com/articles/ignoring-files/

Kevin 凯文

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

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