git diff 两个存储库,从 .git dir 获取结果?

发布于 2024-12-06 15:41:14 字数 265 浏览 0 评论 0原文

我的计算机上有两个版本的 git 存储库,我想知道它们之间的区别,这样我就可以知道是否应该从另一个存储库中拉取。

我做了一个“git diff amslib ../workspace/amslib”,它并没有向我展示两个存储库中提交的文件之间的差异,而是开始向我展示 .git 目录中的差异。

我想我没有正确使用命令,有人能告诉我应该怎么做吗?我只想知道哪个版本的代码有哪些更改,因此我可以合并它们、拉取它们或手动复制它们,因为我想要一些更改,但不需要其他更改。

谢谢

I have two versions of a git repo on my computer, I wanted to know which is the differences between them, so I can know whether I should pull or not from the other repo.

I did a "git diff amslib ../workspace/amslib" and instead of showing me the differences between just the committed files in both repositories, it started to give me the differences in the .git directory too.

I suppose I'm not using the commands right, can anyone tell me how I should do it? I just want to know which version of the code has what changes, so I can either merge them, pull them, or manually copy them because I want some changes, but not others.

thanks

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

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

发布评论

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

评论(2

横笛休吹塞上声 2024-12-13 15:41:14

您应该能够将一个存储库添加为另一个存储库的“远程”,获取额外的提交,然后将它们与当前存储库进行比较。

You should be able to add one respository as a "remote" to the other, fetch the extra commits and then diff them against the current repo.

止于盛夏 2024-12-13 15:41:14

您可以执行普通的递归 diff 并忽略 .git 目录中的任何结果。我怀疑@Noufal 的解决方案更干净,但这是另一种选择。

You could do an ordinary recursive diff and ignore any results from the .git directories. I suspect @Noufal's solution is cleaner, but this is an alternative.

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