git .ignore不能在目录中工作 [英] git .ignore not working in a directory

查看:91
本文介绍了git .ignore不能在目录中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下.gitignore文件

 #文件名为.gitignore 

系统/应用程序/config/database.php
system / application / config / config.php
系统/日志
modules / recaptcha / config / *

然而,当我在config和recapcha.php中添加任何更改时,git状态会提示如下。
当我将任何更改添加到database.php。它不显示状态

  shin @ shin-Latitude-E5420:/ var / www / myapp $ git status 
#分支大师
#你的分支在1次提交之前领先于'origin / master'。

#没有为commit提交更改:
#(使用git add< file> ...更新将提交的内容)
#(使用git

#modified:modules / recaptcha / config / recaptcha.php
#修改:系统/应用程序/结果 - < file> config / config.php

没有更改添加到提交中(使用git add和/或git commit -a)

我该如何解决这个问题?



预先致谢。



我在Ubuntu 11.04上使用git version 1.7.5.1

解决方案

这些文件已存储在本地提交树。您需要将它们从存储库中删除,这可以通过 git rm --cached system / application / config / config.php modules / recaptcha / config / recaptcha.php 完成你需要做出更多的承诺和你的好事。


I have the following .gitignore file

# file named .gitignore

system/application/config/database.php
system/application/config/config.php
system/logs
modules/recaptcha/config/*

However when I add any changes in config and recapcha.php, git status warns me as following. When I add any changes to database.php. it does not show it in status

shin@shin-Latitude-E5420:/var/www/myapp$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   modules/recaptcha/config/recaptcha.php
#   modified:   system/application/config/config.php
#
no changes added to commit (use "git add" and/or "git commit -a")

How can I fix this?

Thanks in advance.

I am using git version 1.7.5.1 on Ubuntu 11.04

解决方案

The files are already stored in your local commit tree. You need to remove them from the repository this can be done via git rm --cached system/application/config/config.php modules/recaptcha/config/recaptcha.php after that you need to make one more commit and your good to go.

这篇关于git .ignore不能在目录中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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