尝试了解 Git 的工作原理

发布于 2025-01-03 13:47:30 字数 250 浏览 2 评论 0原文

我刚刚安装了 eGit 插件并且正在使用它。我是 Git 新手。

我注意到一些奇怪的事情:

我提交了示例项目“Planets”,然后我只修改了一个文件 Planet.java。

然后我查看了 Git 存储库文件夹,修改后的文件 Planet.java 就在那里,但我的其他源文件都没有

这是否意味着如果我从磁盘中删除原始项目文件夹,就会破坏 Git?我的意思是我将无法再恢复该项目之前提交的任何版本吗?

I just installed eGit plugin and I'm playing around with it. I'm new to Git.

I've noticed something strange:

I committed sample project "Planets" then I modified one file only Planet.java.

Then I looked in the Git repository folder, and this modified file Planet.java is there, but none of my other source files are.

Does this mean if I delete my original project folder from the disk, it will break Git? I mean will I not be able to restore any previous committed version of this project anymore?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以歌曲疗慰 2025-01-10 13:47:30

“原始项目文件夹”是您的 Git 存储库。 Git 仅存在*于您执行 git init 的目录中。有关文件的元数据存储在项目目录内的隐藏 .git 目录中。如果删除项目目录,您将删除 Git 存储库的本地副本。

*假设您还没有显式克隆您的存储库

The "original project folder" is your Git repository. Git only exists* within the directory where you performed a git init. Its metadata about your files is stored within a hidden .git directory inside your project directory. If you delete your project directory, you're deleting your local copy of the Git repository.

*Assuming you haven't explicitly cloned your repository

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文