在重建期间如何防止.git目录被复制到bin目录? [英] How do I prevent .git directory from getting copied to bin directory during rebuild?

查看:673
本文介绍了在重建期间如何防止.git目录被复制到bin目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.git目录在我的项目中重新出现,在我认为应该被忽略的目录中。每当我清理项目或在Eclipse中刷新它时,它会重新出现。重复的.git目录导致冗余文件阻止项目构建。

A .git directory keeps reappearing in my project, inside a directory that I think should be ignored. It reappears each time I clean the project or refresh it in Eclipse. The duplicated .git directory results in redundant files that prevent the project from building.

我在Eclipse中有一个Android项目,它连接Java项目的源,这是方式LibGDX处理一个项目。我不想要的.git目录包含一个导致冲突的文件,所以我每次要建立到设备时都必须删除它。

I have an Android project in Eclipse that links source from a Java project, which is the way LibGDX handles a project. The .git directory that I don't want contains a file that causes a conflict, so I have to delete it every time I want to build to device.

它是创建目录MyProject / bin / classes / .git。但我的bin /在我的.gitignore文件。我的存储库位于MyProject中。

It is creating the directory MyProject/bin/classes/.git. But I have bin/ in my .gitignore file. My repository is in MyProject.

冲突的文件是\bin\classes.git\COMMIT_EDITMSG。这与我链接的源Java项目中的文件冲突:\gen.git\COMMIT_EDITMSG。也是同样的问题,因为我在该项目的.gitignore中有\gen。

The conflicting file is \bin\classes.git\COMMIT_EDITMSG. This conflicts with a file in my linked source Java project: \gen.git\COMMIT_EDITMSG. Also the same issue, because I have \gen in the .gitignore of that project.

我很确定Eclipse或ADT正在复制目录转到 bin 目录,当它重建或清理项目。

I am pretty sure either Eclipse or ADT that is copying the .git directory over to the bin directory when it rebuilds or cleans the project.

所以我现在的问题是,如何让Eclipse和/或ADT停止这样做?

So my question now is, how do I get Eclipse and/or ADT to stop doing that?

(如果你想看到我的旧版本) gitignore,我认为是无关紧要的,因为它正确地设置为忽略bin目录,您可以单击已编辑链接在此帖子的历史记录中查看。)

推荐答案

如果你想要的是排除* .git文件在eclipse中构建时被复制,你可以在Java Build Path菜单下为这个特定的项目设置,然后将* .git添加到排除模式中。这里非常棘手,因为您可以指定包含模式或排除模式,但不能同时指定两者。所以,也许你想尝试排除* .git,使其在构建期间不会复制。

If what you want is to exclude *.git file to be copied during the build in eclipse, you can set this under Java Build Path menu for that specific project, and then add *.git into the exclusion patterns. It is quite tricky here because you can either specify inclusion patterns, or exclusion patterns, but not both of them. So, maybe you want to try to exclude *.git so that it does not copy during build.

请参见下面的屏幕截图:

See screenshot below for example:

这篇关于在重建期间如何防止.git目录被复制到bin目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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