在EclipseADT中开发android项目时,将xmlparser /添加到.gitignore是否安全?
现在我正在使用推荐:
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
我问,因为标记为"删除的文件"在git bash中是红色的:
Nenad@I3770K ~/eclipseADT/AA4AB_V3 (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: xmlparser/.classpath
deleted: xmlparser/.project
deleted: xmlparser/AndroidManifest.xml
deleted: xmlparser/gen/android/support/v7/appcompat/R.java
deleted: xmlparser/gen/com/example/xmlparser/BuildConfig.java
deleted: xmlparser/gen/com/example/xmlparser/R.java
deleted: xmlparser/ic_launcher-web.png
deleted: xmlparser/libs/android-support-v4.jar
deleted: xmlparser/proguard-project.txt
deleted: xmlparser/project.properties
deleted: xmlparser/res/drawable-hdpi/ic_launcher.png
deleted: xmlparser/res/drawable-mdpi/ic_launcher.png
deleted: xmlparser/res/drawable-xhdpi/ic_launcher.png
deleted: xmlparser/res/drawable-xxhdpi/ic_launcher.png
deleted: xmlparser/res/layout/activity_main.xml
deleted: xmlparser/res/menu/main.xml
deleted: xmlparser/res/values-v11/styles.xml
deleted: xmlparser/res/values-v14/styles.xml
deleted: xmlparser/res/values-w820dp/dimens.xml
deleted: xmlparser/res/values/dimens.xml
deleted: xmlparser/res/values/string.xml
deleted: xmlparser/res/values/strings.xml
deleted: xmlparser/res/values/styles.xml
deleted: xmlparser/src/com/example/xmlparser/HandleXML.java
deleted: xmlparser/src/com/example/xmlparser/MainActivity.java
no changes added to commit (use "git add" and/or "git commit -a")
更新: 更确切地说,我根本无法找到这些文件夹。工作区是AA4AB_V3,其中有几个项目。但无论我做什么(运行项目,清理和重建),我都无法让它们成为现实。它们根本不存在。我不知道Git在哪里找到它们,但是在该日志中显示的那些文件夹不存在。项目工作正常,我不记得在创建android项目期间,这些文件夹始终存在。
正如用户VonC所指出的,前段时间我运行了this xmlparser教程。当我现在想到它时,是的,我将其命名为xmlparser,然后将其重命名为WeatherApp,后来又关闭了项目。我不知道的是为什么Git会保留关于&#34;删除的信息&#34;文件夹,如果它在某种缓存中,我应该如何清理它?
答案 0 :(得分:1)
@VonC和this帖子帮助我弄清楚发生了什么,我该怎么做。项目被重命名,主分支不同步或其他。
我采取的措施是发出命令:
git rm --cached xmlparser/*
导致了这个:
Nenad@I3770K ~/eclipseADT/AA4AB_V3 (master)
$ git rm --cached xmlparser/*
rm 'xmlparser/.project'
rm 'xmlparser/AndroidManifest.xml'
rm 'xmlparser/gen/android/support/v7/appcompat/R.java'
rm 'xmlparser/gen/com/example/xmlparser/BuildConfig.java'
rm 'xmlparser/gen/com/example/xmlparser/R.java'
rm 'xmlparser/ic_launcher-web.png'
rm 'xmlparser/libs/android-support-v4.jar'
rm 'xmlparser/proguard-project.txt'
rm 'xmlparser/project.properties'
rm 'xmlparser/res/drawable-hdpi/ic_launcher.png'
rm 'xmlparser/res/drawable-mdpi/ic_launcher.png'
rm 'xmlparser/res/drawable-xhdpi/ic_launcher.png'
rm 'xmlparser/res/drawable-xxhdpi/ic_launcher.png'
rm 'xmlparser/res/layout/activity_main.xml'
rm 'xmlparser/res/menu/main.xml'
rm 'xmlparser/res/values-v11/styles.xml'
rm 'xmlparser/res/values-v14/styles.xml'
rm 'xmlparser/res/values-w820dp/dimens.xml'
rm 'xmlparser/res/values/dimens.xml'
rm 'xmlparser/res/values/string.xml'
rm 'xmlparser/res/values/strings.xml'
rm 'xmlparser/res/values/styles.xml'
rm 'xmlparser/src/com/example/xmlparser/HandleXML.java'
rm 'xmlparser/src/com/example/xmlparser/MainActivity.java'
然后我发出了一个提交
git commit -m "026: reset cached files"
并在检查时一切顺利:
Nenad@I3770K ~/eclipseADT/AA4AB_V3 (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
感谢VonC指出我正确的方向!