English 中文(简体)
Git:如何在Windows上忽略文件?
原标题:Git: How to ignore files on Windows?
  • 时间:2010-10-22 09:55:48
  •  标签:
  • windows
  • git

我在存储库位于.git附近的文件夹中创建.gitignore

project
--.git
--.gitignore
--Source
----tmp
----scr

但是git看不到它,也不会t忽略.gitignore中的文件

我的.gignore文件:

*.tmp
*~
*.pdb
*.user
*.suo
Sources/tmp

怎么了?

Up: I created new repositiry, add .gitignore before init commit - it work! But if I add in old repository it doesn`t...

问题回答

问题是,当git的默认语法是regex时,您正在指定glob语法。

请尝试以下操作:

.*.tmp
.*~
.*.pdb
.*.user
.*.suo
Sources/tmp

您所拥有的应该是有效的,尽管您的目录列表有Source/,而您的.gitignoreSources/

脑海中浮现的一件事是,行的结尾可能不是git所期望的。

此外,由于tmp是一个目录,因此通常使用尾随的/:

源/tmp/

最后,您还可以在Source/中创建一个.gitignore,其行如下:

tmp/ instead of having it in the top directory.





相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签