I have a folder called 'assets' ( auto generated when creating a new android app using the wizard in netbeans ) but it does not show up in the git command line, nor does it get added to the repo even if I try to.
Any help?
Sounds like the directory is git-ignored. Check .gitignore at the root of your Git repo, and ~/.gitignore (your global ignore settings). Does assets show up in there? If so, do git add -f assets/ to force the add.
Git doesn't work with (empty) folders, only with files. If you need to commit a folder you need to check a file within, in order to force git to recreate that folder.
I suggest you to commit an empty file that begins with an underscore '.' like ".keep", this file will be ignored by android build process.
I hope that helps you
Related
I have a project in Bitbucket and I want to give access to one of my intern. I want to ignore certain Java files and certain file inside debug folder.
I have tried using the way, adding this line in my gitignore file:
/app/src/main/java/com/example/amanv/emulatordetection/NewActivity.class
However, this didn't work out.
I also tried:
/NewActivity.class
didn't work out too.
How can I do that?
You can not ignore those files that you have previously committed, for that you have to remove those files from your git.
To do that first go to your file directory.
Now type this command to remove the file from your git.
git rm --cached [filename]
Now the file has been removed from your branch, and now
you have to add the file name in your .gitignore file.
filename.java (Remember that the activity extension should be in java.)
After that, add the files to the branch and then commit them. Then
finally, push and you will see the files are ignored.
Please mind, that the path of files you want to ignore with a .gitignore file are relative to the path of your .gitignore file in your repo.
so:
/NewActivity.class
means: ignore the file NewActivity.class in the same directory as .gitignore and not in subdirectories
NewActivity.class
means: ignore the file NewActivity.class in the same directory as .gitignore and in all subdirectories
If you want to use:
/app/src/main/java/com/example/amanv/emulatordetection/NewActivity.class
then your .gitignore file has to be located in a parent direcory of app, which has to be part of your repository of course.
I think the extension should be .java instead of .class.
So instead of this
/app/src/main/java/com/example/amanv/emulatordetection/NewActivity.class
It should be this
/app/src/main/java/com/example/amanv/emulatordetection/NewActivity.java
I've just attempted to create a new mercurial repository using Android Studio (v2.3.2)
I went through the menu option VCS->Import into Version Control->Create Mercurial Repository
The 1st time I did this I was careless and accepted the default folder location for the repo which turned out to be the parent dir of my new project, thus overwriting an existing repo I had there (hopefully I can restore from backup)
The 2nd time I correctly specified the new project dir and I saw that an .hg dir was created in there as expected. Confusingly though, it also created a .gitignore file in the project dir as well.
Does mercurial attempt to read .gitignore files or is this a bug in Android Studio?
Running hg add -n seems to suggest it isn't reading the .gitignore file
I would have expected Android Studio to create an .hgignore file instead?
Is the expectation you have to either rename the .gitignore file to .hgignore and add the syntax: glob line at the top or are you supposed to manually create your own .hgignore file?
I assume it isn't a good idea to simply add all files?
Mercurial doesn't read a .gitignore file or treat it specially in any way.
However you can probably convert it by adding the syntax: glob directive at the top and renaming - as you suggest yourself
How do I keep library files out of my github repo yet still have them work if someone downloads my code? I get about 600 "changes" each time I make a small change to my code! Also if it changes anything I am using github desktop (not through cmd). Thanks in advance!
you need to use git ignore to ignore your build folders from updating with git. git ignore helps you to make a blacklist of items you dont want to commit everytime.
you can see how to make a git ignore file in below:
How to create .gitignore file
I guess you see changes to the workspace files modified by Android Studio / IntelliJ in the .idea folder. These files are automatically re-generated if you remove them and should be private to each user, i.e. not uploaded to source control with git.
Step by step fix
Close Android Studio
Remove the .idea folder in your project root (or backup elsewhere for now)
in the .gitignore file in the root of your project, add a line containing just .idea to ignore the folder and its content when you use git
Commit changes to git which should be the removal of the .idea folder & the .gitignore change
Open Android Studio, re-import you project
.idea folder is now regenerated and private to each git user
Run git status to verify
I have a directory in my project that is being ignored but it is not in any of the places that I would expect ignored folders to be (.gitignore, exclude or config).
it is an Android Studio project that I build with gradle, my VCS is Git.
I'm using SourceTree & GitBash to manage the repo.
I've reset all .ignore files in my project to be empty, \info\exclude is empty and config doesn't have 'excludesfile' property.
folder being ignored is - 'myProj/app/src/debug/res/raw/'
have no idea how this folder got ignored in the first place.
there is a different relative folder 'myProj/app/src/debug/res/values' that is tracked by git.
Is there any other place I didn't look that set ignore files?
Is there any git command that can show where is this folder being set as ignored folder?
maybe a binary I overlooked that I can just delete?
currently running 'git status --ignored' show only 'myProj/app/src/debug/res/raw/' as ignored.
Use git check-ignore -v myProj/app/src/debug/res/raw/ to see where the ignore is. You may have to give it the name of a file in that directory instead of the directory itself.
Thanks guys for responding so quick,
I've eventually resolved the issue by just adding the folder using:
git add -f myProj/app/src/debug/res/raw/
then commit and push, this was suppose to be a meanwhile solution until real solution is found but did the trick, after doing that the folder started to be tracked.
Note that your rule may also exist in the .gitignore_global file (in your user folder). You may have accidentally added it by choosing "Global ignore list" in the "Add this ignore entry to" dropdown in SourceTree.
You usually don't want to add a folder name to your global ignore list
I know this question is 5 years old but it's the first one on Google results.
Another possibility besides the ones mentioned before is that the folder has been added as a submodule. E.g. in GitHub, the bottom folder is a submodule:
This happened to me recently while copying a whole git project into another. That is, my repo looked like this:
repo
|
|__ .gitignore
|__ .git/ #git folder for repo
|__ some_files.ext
|
|__ ignored_folder
|__ .git/ #git folder of the copied repo
|__ .gitignore
|__ some_other_files.ext
My specific solution was to:
Cut the whole ignored_folder outside of the repo.
Add&commit to delete the submodule in the repo
Delete the .git folder inside the moved ignored_folder.
Move the ignored_folder back in.
Add&commit.
However, I'm sure there are much better git-like solutions.
I am working on an Android App and the APK file is located in the out folder. I am also using Mercurial as version control system and cloned the repo, the clone was successful but Mercurial created two APK files one inside the bin directory and another in the root directory of the project.
Why Mercurial created these extra two APK files and how to get rid of them?
You have these two files in repo, clone just show it to you
You didn't see only these files in original Working Copy, because (not discovered yet) local settings for original workspace now ignore these files (after they was commited to repo - see hg log FILENAME), but adding to ignore-list doesn't mean "automatically forget and remove from repo"
how to get rid of them?
In cloned repo-root create .hgignore, add global pattern for all and any (?) *.apk-file
hg forget both APK (or Forget from CMenu of THG)
commit changes
remove files from WorkingCopy