主文件夹下多个Android项目的.gitignore文件? [英] .gitignore file for multiple Android projects under a master folder?

查看:165
本文介绍了主文件夹下多个Android项目的.gitignore文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在为Android Studio工作区构建.gitignore文件时遇到问题,这是我的文件夹设置:

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

Android Workspace ---
-> 学校/Application1,Application2等,
-> 项目/Application1,Application2等

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

Android Workspace是主文件夹,学校"和项目"用于组织我的应用程序,它们包含我创建新的Android Studio项目时创建的文件夹.

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.

我创建了一个.gitignore文件,并将其放置在Android Workspace中,但是它似乎并没有忽略这些文件,然后我尝试在每个子目录中放置两个.gitignore文件,但这也不起作用,因此,我的问题是:无论嵌套的深度如何,如何构造.gitignore文件以忽略来自Android Workspace文件夹的不必要的Android Studio文件?还是我必须在每个应用程序目录中放置一个.gitignore?

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?

谢谢,这是我正在使用的.gitignore文件(由 https://www.gitignore.io/生成):

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

推荐答案

您可以创建

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

它将在您的主文件夹中创建一个.gitignore_global文件,其中应包含要忽略的文件/文件夹.

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

这篇关于主文件夹下多个Android项目的.gitignore文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆