git diff 两个存储库,从 .git dir 获取结果?
我的计算机上有两个版本的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够将一个存储库添加为另一个存储库的“远程”,获取额外的提交,然后将它们与当前存储库进行比较。
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.
您可以执行普通的递归
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.