开发者

How do I tell Git to ignore a specific filename only in the repository's top level? [duplicate]

开发者 https://www.devze.com 2023-03-09 15:23 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to exclude file only from root folder in GIT
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to exclude file only from root folder in GIT

For a specific JavaScript project, I am using the TinyWeb HTTP Server for local testing (to work around a specific security limitation that applies to file URLs). Th开发者_如何学Cat program requires I have an index.html file in the root directory, but I do not want to commit that file to my Git repository.

How can I stop Git from bugging me about this "untracked file" on every commit? I do want to commit all index.html files located in subdirectories.


Add this to your .gitignore (in the root folder):

/index.html

The leading / makes git use an absolute path (relative to the current .gitignore location), whereas all other lines are just treated as some kind of wildcard.

0

精彩评论

暂无评论...
验证码 换一张
取 消