简体   繁体   English

如何在Android Studio中提交时隐藏.gitignore文件

[英]How to hide .gitignore files while committing in Android Studio

Currently i am using Android Studio version 2.2. 目前,我正在使用Android Studio 2.2版。

Once we add configuration file into .gitignore file of project root directory and then make any changes to ignore files, Still it shows these changed file while committing. 一旦我们将配置文件添加到项目根目录的.gitignore文件中,然后进行任何更改以忽略文件,则仍会在提交时显示这些更改的文件。

So how can we avoid these files from showing up while committing. 因此,如何避免在提交时显示这些文件。

I have tried removing ignore files file from Setting->Version Control->Ignore Files , And restarted the Studio.But is doesn't work. 我尝试从设置->版本控制->忽略文件中删除忽略文件文件,然后重新启动Studio。但是不起作用。

I have tried to removing previously cached file from git rm -r --cached . 我试图从git rm -r --cached删除以前缓存的文件。 And then re-added the gitignore files and added the project again. 然后重新添加gitignore文件并再次添加项目。

But still all the git ignore file shows while committing and leads to problem by mistakenly selecting them. 但是,所有git忽略文件仍然在提交时显示,并且由于错误选择它们而导致问题。

Anyone who have faced this please guide to remove these git ignore file while committing in Android Studio. 遇到此问题的任何人都请指导在Android Studio中提交时删除这些git ignore文件。

Have tired this but didn't get any help. 对此感到厌倦,但没有得到任何帮助。

You need to remove (or "ignore") these files from version control. 您需要从版本控制中删除(或“忽略”)这些文件。

One option is: 一种选择是:

  1. Close Android Studio; 关闭Android Studio;
  2. Remove the files that you need to remove from vcs (probably something like rm -rf .idea/ ); 删除您需要从vcs中删除的文件(可能类似于rm -rf .idea/ );
  3. Commit your changes; 提交您的更改;
  4. Make sure that all files that you want are on your .gitignore ; 确保所需的所有文件都位于.gitignore
  5. Reopen Android Studio; 重新打开Android Studio;

Now he will create all files that he needs to execute, such as .idea folder, but you don't need to worry because now they are out of version control. 现在,他将创建他需要执行的所有文件,例如.idea文件夹,但是您不必担心,因为现在它们已经脱离了版本控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM