将新创建的特定文件夹添加到Git中的.gitignore中 [英] Add newly created specific folder to .gitignore in Git
问题描述
我有一个干净的工作目录,昨天晚上从Git仓库中引入了一个克隆。
但现在我的本地服务器创建并包含一个我想忽略的stats文件夹。
<$ p $当我运行git状态时,我似乎无法让Git忽略此文件夹。 p> 关于分支master
您的分支在1次提交之前位于'origin / master'之前。
要提交的更改:
(使用git reset HEAD< file> ...停用)
新文件:app_public / views / pages /privacy.php
新文件:app_public / views / pages / terms.php
新文件:public_html / stats / ctry_usage_200908.png
新文件:public_html / stats / daily_usage_200908.png
新文件:public_html / stats / dns_cache.db
新文件:public_html / stats / hourly_usage_200908.png
新文件:public_html / stats / index.html
新文件:public_html / stats /usage.png
新文件:public_html / stats / usage_200908.html
新文件:public_html / stats / webalizer.current
新文件:public_html / stats / webalizer.hist
已更改但未更新:
已修改:.gitignore
我在我的.gitignore几行不同,但它仍然试图添加它们:
public_html / stats
public_html / stats / * *
public_html / stats / ** / *
public_html / stats / *
试试 但是,由于 / public_html / stats / * < code $?
中的文件报告为要提交 / em>这意味着你已经手动添加了它们。当然,在这种情况下,忽略一点已经太晚了。你可以
git rm --cache
them(IIRC)。
I had a clean working directory and brought in a clone from a Git repo last night. But now my local server created and contains a stats folder which I want to ignore.
I can't seem to get Git to ignore this folder when I run a git status.
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: app_public/views/pages/privacy.php
new file: app_public/views/pages/terms.php
new file: public_html/stats/ctry_usage_200908.png
new file: public_html/stats/daily_usage_200908.png
new file: public_html/stats/dns_cache.db
new file: public_html/stats/hourly_usage_200908.png
new file: public_html/stats/index.html
new file: public_html/stats/usage.png
new file: public_html/stats/usage_200908.html
new file: public_html/stats/webalizer.current
new file: public_html/stats/webalizer.hist
Changed but not updated:
modified: .gitignore
I added in my .gitignore a few different lines but it still trying to add them:
public_html/stats
public_html/stats/**
public_html/stats/**/*
public_html/stats/*
Try /public_html/stats/*
?
But since the files in git status
reported as to be commited that means you've already added them manually. In which case, of course, it's a bit too late to ignore. You can git rm --cache
them (IIRC).
这篇关于将新创建的特定文件夹添加到Git中的.gitignore中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!