Gitignore不工作 [英] Gitignore not working

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

问题描述

我的 .gitignore 文件出于某种原因无法正常工作,并且没有任何Google搜索功能能够修复它。这里是我的:

  *。apk 
* .ap_
* .dex
* .class
** / bin /
** / gen /
.gradle /
build /
local.properties
** / proguard /
* .log

它位于 master ,这是我的git回购。我正在运行Git 1.8.4.2,因为我使用的是运行OSX 10.8.6的MacBook。

文件/文件夹在您的版本控制中不会仅仅因为您现在将它们添加到 .gitignore 中而将它们自己删除。他们已经在存储库中。你必须删除它们。你可以这样做:

  git rm -rf --cached。 
git add。

这将删除存储库中的所有文件并将它们添加回来(此时尊重的.gitignore )。



请记住在做这件事之前完成所有已更改的内容。


My .gitignore file isn't working for some reason, and no amount of Googling has been able to fix it. Here is what I have:

*.apk
*.ap_
*.dex
*.class
**/bin/
**/gen/
.gradle/
build/
local.properties
**/proguard/
*.log

It's in the directory master, which is my git repo. I'm running Git 1.8.4.2 because I'm on a MacBook running OSX 10.8.6.

解决方案

The files/folder in your version control will not just delete themselves just because you added them to the .gitignore now. They are already in the repository. You have to remove them. You can just do this with this:

git rm -rf --cached .
git add .

This removes all files from the repository and adds them back (this time respecting the rules in your .gitignore).

Remember to commit everything you've changed before you do this.

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

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