.gitignore file for multiple Android projects under a master folder?

杀马特。学长 韩版系。学妹 提交于 2019-12-12 05:28:28

问题


I am having a problem building a .gitignore file for my Android Studio workspace, this is my folder setup:

Android Workspace---
-> School/Application1, Application2, etc.,
-> Projects/Application1, Application2, etc.

Android Workspace is the master folder, School and Projects are used to organize my applications, They contain the folders created when I create a new Android Studio project.

I created a .gitignore file and placed it in Android Workspace, but it doesn't seem to be ignoring the files, I then tried placing two .gitignore files in each sub directory, but that didn't work either, so, my question is: How do I structure my .gitignore file to ignore the unnecessary Android Studio files from the Android Workspace folder no matter how deeply nested they are? Or do I have to place a .gitignore in each of the application's directory?

Thanks, and here's the .gitignore file I'm using (Generated by https://www.gitignore.io/):

### Android ###
# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/

# Gradle files
.gradle/
build/
/*/build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

回答1:


You can create a global .gitignore that will have the files/folders to be ignored in all git projects. For this, just run the following command

git config --global core.excludesfile ~/.gitignore_global

It will create a .gitignore_global file in your home folder that should have the files/folders to be ignored.



来源:https://stackoverflow.com/questions/28923160/gitignore-file-for-multiple-android-projects-under-a-master-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!