如何将.git文件夹保存在Cloned Eclipse项目中

编程入门 行业动态 更新时间:2024-10-21 05:45:23
本文介绍了如何将.git文件夹保存在Cloned Eclipse项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 从克隆的git存储库导入Eclipse项目之后,我进行了一些修改并提交了 - wtf?我得到一个.git文件夹添加到项目中,整个shebang与头和参考,最糟糕的是整个对象数据库被添加到项目中,所有文件/文件夹有这个小问题标记图标表示文件尚未添加/尚未被git跟踪。这个.git文件夹存在于实际的工作目录中(这甚至有意义)。你可以想象,当尝试使用同步工具/视图(这应该使生活更容易提交,你可以看到所有的变化和更改的文件和差异),这是一个烦恼。

问题(tl; dr) 如何从克隆的git存储库正确导入Eclipse项目?当我提交时,我不希望在Team> Synchronize中显示一个.git文件夹,让.git文件夹位于我的项目之外的其他位置。

其他信息 我在Windows 7上使用Eclipse Indigo和Egit。 我正在使用Egit从 git.apache/ 克隆git repo (thebiz项目,确切地说),在向导中,我选择从这个新克隆的repo导入现有项目的选项。 是的,我知道我从Egit可能会有多少期望。事实上,如果有任何替代方法(外部git工具?命令行git for Windows?其他?)在Eclipse中使用git-tracked项目,将实际的.git东西保留在项目之外,我很乐意放弃Egit

解决方案

我完全同意 - 我无法想象会永远是任何人提交.git文件夹的意图! p>

并且git / EGit 知道这是项目的存储库文件夹,所以应该很容易实现相应的异常 - 以便这个文件夹不会成为同步的一部分。

我知道以下内容不能解决您的问题,但是如果您控制文件在存储库中的排列方式,您就可以可以选择将Eclipse项目文件夹不是作为存储库的根文件夹,而是一个子文件夹。

这也允许你在存储库中放置不应该出现在Eclipse中的东西,甚至是哈哈多个Eclipse项目分组在一个存储库中(如果您希望这样做)。

Issue After importing an Eclipse project from a cloned git repository, I make some changes and commit - and wtf? I get a ".git" folder added to the project, the whole shebang with the heads and refs and worst of all the whole object database gets added to the project, all files/folders having that little question-mark icon signaling that the files have not been added / are not yet tracked by git. This .git folder exists in the actual Working Directory (how does that even make sense?). You can imagine what an annoyance this causes when trying to use the "Synchronize" tool/view (which is supposed to make life easier for committing, you can see all the changes and changed files and diffs).

Question (tl;dr) How to correctly import an Eclipse project from a cloned git repository? I don't want a .git folder showing up in "Team > Synchronize" when I commit, let the .git folder reside somewhere else outside of my project.

Additional Info I'm on Windows 7 using Eclipse Indigo and Egit. I am using Egit to clone a git repo from git.apache/ (the ofbiz project, to be exact) and in the wizard I choose the option to import an existing project from this newly cloned repo. Yes I am aware of how little I may expect from Egit. In fact, if there are any alternative ways (external git tool? command line git for windows? other?) to use a git-tracked project in Eclipse which keeps the actual .git stuff out of the project, i'd gladly abandon Egit.

解决方案

I totally agree - I can't imagine it would ever be anyones intent to commit the .git folder!

And git/EGit knows that this is the repository folder of the project, so it should be easy to implement the appropriate exception - so that this folder does not become part of the synchronization.

I know the following does not solve your problem, but in cases where you control the way files are layed out in the repository, you could choose to have the Eclipse project folder not be the root folder of the repository, but rather a sub-folder.

This also allows you to have stuff in the repository that should not show up in Eclipse, or even have multiple Eclipse projects grouped in one repository (if you should wish to do so).

更多推荐

如何将.git文件夹保存在Cloned Eclipse项目中

本文发布于:2023-11-12 12:04:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581456.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   文件夹   项目   git   Cloned

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!