Git 我的手指怎么了?
我的Git 我的手指怎么了?,git,gitignore,Git,Gitignore,我的.gitignore文件有什么问题 build/ /build /*/build/ /*/*/build/ build/ 这是我的目录结构: myroot FacebookSDK +--src +--build +--foo +-- bar app +--scr +--build build +--other stuff...
.gitignore
文件有什么问题
build/
/build
/*/build/
/*/*/build/
build/
这是我的目录结构:
myroot
FacebookSDK
+--src
+--build
+--foo
+-- bar
app
+--scr
+--build
build
+--other stuff...
+--other stuff..
.gitignore
other stuff...
/build
/*/build/
/*/*/build/
./build
./*/build/
./*/*/build/
问题是,foo和bar不会被忽略
出了什么问题
xxxxs-my:xxxx xxx$ git status
On branch master
Your branch is up-to-date with 'origin/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: FacebookSDK/FacebookSDK.iml
modified: FacebookSDK/build.gradle
modified: FacebookSDK/build/intermediates/bundles/debug/classes.jar
modified: FacebookSDK/build/intermediates/bundles/debug/res/drawable/com_facebook_button_blue.xml
xxxxs我的:xxxx xxx$git状态
论分行行长
您的分支机构是最新的“原始/主”分支机构。
未为提交而暂存的更改:
(使用“git add…”更新将提交的内容)
(使用“git签出--…”放弃工作目录中的更改)
修改:FacebookSDK/FacebookSDK.iml
修改:FacebookSDK/build.gradle
修改:FacebookSDK/build/intermediates/bundles/debug/classes.jar
修改:FacebookSDK/build/intermediates/bundles/debug/res/drawable/com\u facebook\u button\u blue.xml
我认为这是因为您的忽略行中有三行来自根目录:
myroot
FacebookSDK
+--src
+--build
+--foo
+-- bar
app
+--scr
+--build
build
+--other stuff...
+--other stuff..
.gitignore
other stuff...
/build
/*/build/
/*/*/build/
./build
./*/build/
./*/*/build/
当它们应该来自当前目录时:
myroot
FacebookSDK
+--src
+--build
+--foo
+-- bar
app
+--scr
+--build
build
+--other stuff...
+--other stuff..
.gitignore
other stuff...
/build
/*/build/
/*/*/build/
./build
./*/build/
./*/*/build/
试用
build/
**/build/
在.git中忽略
如果文件已被跟踪,请使用
git rm--cached myfile
将其从版本控制中删除,但保留在本地repo中。一旦从版本控制中删除,它们就不会在更改时被检测到。您应该只需要以下规则:
这将全局排除build
文件夹
如果之前添加了这些文件夹中的任何一个,则必须通过Git-rm
将其从Git中删除
你的.gitignore实际上有什么问题:
/build
和build/
是等效的;它们将匹配顶级build/
文件夹
/*/build
和/*/*/build
不匹配任何内容
它来自Git文件夹的上下文。记住:Git不关心任何不在其跟踪器中的东西。啊,我明白了。如果她只是有*/build/
,而不是在前面加上任何前斜杠,这会不会不起作用?你已经提交了那些目录了吗?如果您这样做了,您必须删除GIT的“build”存储库,并且在“build”之后,其他子文件夹将被正确忽略。我不知道,相同的结果:-(((您确定以前没有将这些文件添加到GIT吗?如果您执行了GIT status&&GIT add.
,它是否仍会将它们拾取?)?