为什么 Git 在签出旧版本时会显示某些新文件夹?

发布于 2024-08-25 04:04:30 字数 347 浏览 12 评论 0原文

我仍在学习 Git 的诀窍(喜欢它!),但有一天我注意到一些我不理解的行为。本质上,我们有三个文件夹在不同时间移入存储库(一个是在我们创建存储库后立即移动的,一个是稍后移动的,一个是最近移动的)。最近,我必须从旧版本中获取一些代码。我曾经

git checkout <old SHA1 hash>

拉出我们的第一个签入,当时我注意到 Git 显示了旧文件夹(它应该),以及最新的文件夹(已添加到存储库中< /strong> 在签出提交之后)。但它没有显示第二个文件夹。

什么会导致 Git 显示带有旧版本的最新文件夹?

I'm still learning the ropes of Git (love it!) but the other day I noticed some behavior I just do not understand. We have, in essence, three folders that got moved into the repository at different times (one immediately after we created the repo, one a little while later, and one just recently). Recently, I had to get some code out of an old revision. I used

git checkout <old SHA1 hash>

to pull up one of our first checkins, when I noticed Git showed the old folder (as it should), as well as the newest folder (which got added to the repo long after the checked out commit was made). But it did not show the second folder.

What would cause Git to display the newest folder with the old revision?

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

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

发布评论

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

评论(1

幸福不弃 2024-09-01 04:04:30

文件夹中可能存在未跟踪的文件(自动保存、隐藏文件等)。 Git 不想杀死未跟踪的文件,因此它不会删除它们所在的目录。

There are probably untracked files (auto saves, hidden files, etc) in the folder. Git doesn't want to kill your untracked files, so it won't remove the directory they live in.

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