[英]Git is not ignoring neither checking out .vs folder (VS2015)
In my .gitignore file, there's a line to ignore the Visual Studio 2015 folder (".vs/"), but it's not being ignored. 在我的.gitignore文件中,有一行可以忽略Visual Studio 2015文件夹(“ .vs /”),但不会被忽略。
And, besides, I can't use the checkout command. 而且,此外,我不能使用checkout命令。 That's what was returned:
那就是返回的内容:
Untracked files:
(use "git add <file>..." to include in what will be committed)
.vs/
PS C:\path\to\project> git checkout -- .vs/
error: pathspec '.vs/' did not match any file(s) known to git.
What's wrong? 怎么了?
Try below - 尝试以下-
git rm -r .vs
then open .gitignore
and add end of file 然后打开
.gitignore
并添加文件结尾
.vs/
This should work 这应该工作
Make sure you do have a .gitignore
file at the same level (or above) of the .vs
folder, and that it does contain .vs/
(no extra space at the end of that line). 请确保你有一个
.gitignore
在同一级别(或以上)的文件.vs
文件夹,而且它确实包含.vs/
(在该行的末尾没有多余的空间)。
Try that same rule in a subfolder/.vs
(where you would create a lest a file), to see if it does work there. 尝试在
subfolder/.vs
(您将在其中创建一个文件)中使用相同的规则,以查看该文件是否在此处起作用。
I don't know about the checkout problem, but I encountered the ".vs" problem today. 我不知道结帐问题,但今天遇到了“ .vs”问题。 It's because my .gitignore file was created in VS, therefore the file was encoded with UTF8 with BOM, and ".vs" was written on the first line.
这是因为我的.gitignore文件是在VS中创建的,因此该文件使用带有 BOM的UTF8进行了编码,并且在第一行中写入了“ .vs”。 Since git cannot properly read the first line, ".vs" wouldn't work.
由于git无法正确读取第一行,因此“ .vs”不起作用。 Typical MS style... Just remove the BOM.
典型的MS样式...只需删除BOM。
Your path should be .vs\\
您的路径应为
.vs\\
The syntax for .tfignore is not well understood. .tfignore的语法没有被很好地理解。
Visual Studio Websites (NOT projects), do not have the " Exclude From Project " option on the right-click context menu. Visual Studio网站(非项目)在右键单击上下文菜单上没有“ 从项目中排除 ”选项。 This is where .tfignore comes very handy.
这是.tfignore派上用场的地方。
- # begins a comment line (omit single quotes)
#开始注释行(省略单引号)
- The * and ?
*和? wildcards are supported.
支持通配符。
- A filespec is recursive unless prefixed by the \\ character.
除非以\\字符为前缀,否则filespec是递归的。
- !
! negates a filespec (files that match the pattern are not ignored)
对filespec求反(不忽略与模式匹配的文件)
Given project structure: myproject\\subfoler\\file.ext 给定的项目结构: myproject \\ subfoler \\ file.ext
myproject\\*.*
# Ignores ONLY files in the folder but NOT the sub-folders.
\\myproject\\*.*
# Ignores all files ONLY in the sub-folder
\\myproject\\subfoler\\*.*
# Ignores all files in this folder and all sub-folders.
myproject\\*.* !myproject\\subfolder\\*.ext
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.