Git添加。忽略.gitignore [英] Git add . ignores .gitignore

查看:155
本文介绍了Git添加。忽略.gitignore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $ git --version:
git版本1.7.9.5

$ cat / etc / issue:
Ubuntu 12.04.3 LTS \ n \

$猫.gitignore
** / ._ *
** / *。swp
** /。DS_Store
log /
bak /

$ git status
在分支主机上
更改没有进行提交:
(使用git add< file> ; ...更新将要提交的内容)
(使用git checkout - < file> ...放弃工作目录中的更改)

修改:html / conf /._ conf.php
修改:html / conf / conf.php

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

如上所示,我在.gitignore中包含** / ._ *。
我首先创建了.gitignore,然后是git init和finalygit add。。我提交了一切,然后更改了html / conf / conf.php。正如你在git status的输出中看到的那样,._conf.php不会被忽略。这里的任何人,谁可以帮助我呢?我阅读了很多教程,但显然我错过了一些东西。



请问git add。忽略忽略列表?如果是这样,我需要做些什么来避免这种情况?与* /._ 匹配的新建文件会被正确忽略。



尝试git update-index --assume-unchanged ** / ._ *导致

致命:无法标记文件doku / .blabla.txt



我的想法不多了......

预先感谢! p>

解决方案

.gitignore 仅考虑新文件。



如果您的文件已被Git跟踪,然后修改,则应该使用 git add。进行更改。



您可以将这些文件的状态设置为假定不变:

  git update-index --assume-unchanged< file> 

http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html


$ git --version:  
git version 1.7.9.5

$ cat /etc/issue:  
Ubuntu 12.04.3 LTS \n \l

$cat .gitignore  
**/._*  
**/*.swp  
**/.DS_Store  
log/  
bak/  

$ git status  
On branch master  
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:   html/conf/._conf.php  
modified:   html/conf/conf.php  

no changes added to commit (use "git add" and/or "git commit -a")  

As shown above, i included **/._* in my .gitignore.
I created the .gitignore first, then "git init" and finaly "git add .". I commited everything and then changed html/conf/conf.php. As you can see in the output of "git status" the ._conf.php is not ignored. Anyone here, who can help me with that? I read so many tutorials, but obviously i'm missing something.

Does "git add ." ignore the ignore-list? If so, what do i have to do to avoid that? New created files matching */._ are ignored correctly.

Trying "git update-index --assume-unchanged **/._*" results in
fatal: Unable to mark file doku/._blabla.txt

I'm running out of ideas ...

Thanks in advance!

解决方案

.gitignore is taking into consideration only for new files.

If your files are already tracked by Git and then modified the changes should be staged with git add ..

You can set the status of these files to "assume unchanged" with:

git update-index --assume-unchanged <file>

http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html

这篇关于Git添加。忽略.gitignore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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