How to hide .gitignore files while committing in Android Studio - android-studio

Currently i am using Android Studio version 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.
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.
I have tried to removing previously cached file from git rm -r --cached .
And then re-added the gitignore files and added the project again.
But still all the git ignore file shows while committing and leads to problem by mistakenly selecting them.
Anyone who have faced this please guide to remove these git ignore file while committing in Android Studio.
Have tired this but didn't get any help.

You need to remove (or "ignore") these files from version control.
One option is:
Close Android Studio;
Remove the files that you need to remove from vcs (probably something like rm -rf .idea/);
Commit your changes;
Make sure that all files that you want are on your .gitignore;
Reopen 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.

Related

Gradle folder fills on open

When i clone my github repository my gradle folder automatically fills with 3000 + files. I have a .gitignore file ignoring the .gradle folder. This results in 3000+ files needing a commit on git. No other users of the repo gets these, and their gradle folder only has few files shown in picture 1 (my gradle folder is shown in picture 2).
Its frustrating, since it leads to errors in github, when i have to commit this many files.
Mostly likely - the gradle home is probably set as ./gradle in your Intellij or your login profile.
it should ideally be /Users/<>/.gradle

How to detach a folder from being tracked without deleting any files from it?

I completed MyProject1 and have uploaded it in git in fine way with commits after adding each new features. And now I'm starting MyProject2 and was trying to add the URL for the remote repository. But then I found out that I had mistakenly added the URL in Documents instead of MyProject1 folder because of which MyProject2 folder is also being tracked in MyProject1. And I'm not being able to add URL to MyProject2 but instead facing merge issues.
Is there any way to detach the track from my Document folder without deleting any of my files from Documents.
Structure is this way(I'm using Linux):
Documents
(And inside Documents there is:)
MyProject1
MyProject2
And other folders which are also being tracked.
We can manually do it with below steps
create a file .gitignore in base directory.
If MyProject1 and MyProject2 are already part of git tracking, Please run commands
git rm -r --cached MyProject1/
git rm -r --cached MyProject2/
Open the file in text editor and add below lines in file
MyProject1/
MyProject2/
Best way:
Create a .gitignore file following #Vinayagam R
Ignore file locally
Those methods won't affect other contributors working on the same remote repository:
Use update-index:
If you want to stop tracking a file at certian point.
git update-index --assume-unchanged yourDirectoryName
--assume-unchanged is the flag which means the files should not change locally. In other words, it is used when ignore files that you do not need to change locally (or should not change).
To revert it use update-index --no-assume-unchanged yourDirectoryName
Using .exclude
In your working directory edit .git/info/exclude

How to set global .gitignore file in Android studio

I'm starting to use Android Studio as a git client for my projects. But I cannot find where I can set global .gitignore file for filtering files on any project by default.
The same is done in SourceTree in tools-options-git-global_gitignore_list.
Create a file listing your git ignore patterns and configure it as the global excludesfile. For example, if you're on a Unix-like system and have a .gitignore file in your home directory, you would run:
git config --global core.excludesfile '~/.gitignore'
Android Studio should pick it up automatically (although you may have to restart it). Make sure the git client on your command line is the same as the one AS is configured to use.

Geb Testing - project folder structure contains lot of files ending as closure.class

I am new to geb testing. We have two project folders. One of them is a subset of others. During last few days, whenever I check the status of the subset project folder using git shell, lot of closure.class files are showing as changed. But I am changing only the groovy files. I am not sure why this is happening? previously I haven't seen anything like this.
Also lot of class files are showing as untracked files.
The file name look like this.
xxx$_$spock_feature_7_29_closure6.class
We are using IntelliJ IDE.
There are lots of files, I mean class files generated when you try to build using gradlew. As Peter had suggested already, create a .gitignore file and add anything you want to ignore, for instance:
*.log
build
.gradle
.DS_Store
*.ipr
*.iml
*.iws
out
*.pem
gradle.properties
and run the gradlew clean command. You will not see those anymore. Cheers!

sharing source between Linux eclipse and MS Visual Studio

I have a linux eclipse project checked into our company svn. Works great.
The project is intended to be cross compiled on Windows.
Untill now, I have simply moved the source files between OSes. However, I thought I'd like to let svn do this for me. Should be simple enough, just checkout the eclipse linux src into the VS project dir, right? Wrong!
The correct source was checked out of svn and it worked fine. But when I tried to check it back in i kept getting "Commit not completed filename remains in conflict" errors. I hadn't even changed anything!
Did a little checking. Turns out the linux src directory is pretty much just the source and headers. On the MSVS side the project directory contains the source and headers but also contains a bunch of files that are used by VS with names like projname.vcproj etc. etc.
So, I did a checkout into a scratch dirextory, .\fred. Checked .\fred back in. No problems. Added a new file to .fred, xxx.xxx. Check in reported:
svn: E200009: Commit failed (details follow):
svn: E200009: 'C:\Projects\fred\xxx.xxx' is not under version control
Makes me wonder about those uncommitted Visual Studio files.
So, are those files my problem? Are they breaking the commit operation?
As an alternate solution I am thinking of adding the VS files to the src dir in svn. If linux/eclipse checks them out I can tell eclipse to ignore them (I think it'll just ignore them for me). Any thoughts or recommendations for this approach?
(BTW, i still had fresh source on the linux side so any thing that got clobbered could be safely restored.)
So here is one solution I have working for the moment. I am not sure how totally stable it is.
Caveat: The project i am using already existed as a MSVS project.
In the MSVS solution dir, rename the source dir (MSVS likes the source dir name to match the solution dir name, so this means the source dir may not be named src) to something uninvolved in the solution, like temp.
SVN checkout the src (eclipse like to call source dirs src).
cd into the source dir. Issue the command:
svn changelist msvs *.cpp *.h
Add *.c if needed. "msvs" is the changelist name. It can be whatever you want ti to be.
This will created a changelist for the checked out directory.
Now, copy the remaining files from the temp directory into your source dir.
When you need to do a checkin, cd into the source dir and issue this command:
svn ci --changelist msvs
Note. You have to be in the src dir for this to work.

Resources