忽略Git版本控制中的父目录 [英] Ignore parent directory in Git version control

查看:102
本文介绍了忽略Git版本控制中的父目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何忽略.gitignore中的父目录? 我尝试了这种模式,但似乎不起作用:

How to ignore parent directory in .gitignore? I tried this patterns, but seems they are don't work:

/../*
../
../*

推荐答案

如果想要对.gitignore进行版本控制,则不能.

You can't, if you want your .gitignore to be versioned.

如果已版本化,则意味着父文件夹的元素也已版本化(如果不从索引中删除其所有内容,则不能忽略它).
Kingcrunch

And if it is versioned, that means elements of the parent folder is versioned as well (and cannot be ignored without removing from the index all of its content).
Kingcrunch comments you could still version the .gitignore with a git add -f, but as commented before, this would be quite confusing.

如果最好将.gitignore放在要忽略的文件夹的父文件夹中.
然后那里声明要忽略的文件夹的名称:

If it best to place the .gitignore in the parent folder of the folder you want to ignore.
And there declare the name of the folder you want to ignore:

folder_to_ignore/

(请注意最后一个'/')

(Note the final '/')

这篇关于忽略Git版本控制中的父目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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