如何区分我的回购和非来源的远程回购?
How can I diff between my repo and a remote repo that's not origin?
来自 Viewing Unpushed Git Commits 我知道如何区分我自己的回购和本地提交:
git diff origin/master..HEAD
但是,我怎样才能使用 path/to/github/repo.git
而不是原点呢?
git diff https://github.com/malarres/universal.git/GPII-795..HEAD
返回:
fatal: Invalid object name 'https'.
How can I do the same instead of origin
using a path/to/github/repo.git
?
git diff https://github.com/malarres/universal.git/GPII-795..HEAD
那不是 git diff
的工作方式。如果你想区分你的本地仓库和另一个仓库,你需要执行以下操作:
将后者添加为前者的远程。请注意,除了 origin
之外,没有什么能阻止您在一个存储库中定义多个遥控器。 (不过,您可能希望选择一个比“其他”更不通用的远程名称。)
git remote add other https://github.com/malarres/universal.git/GPII-795
从远程获取所有内容:
git fetch other
运行 适当的 git diff
命令,例如,
git diff other/master..HEAD
如果您稍后想从您的存储库中删除该遥控器,您可以运行
git remote rm other
来自 Viewing Unpushed Git Commits 我知道如何区分我自己的回购和本地提交:
git diff origin/master..HEAD
但是,我怎样才能使用 path/to/github/repo.git
而不是原点呢?
git diff https://github.com/malarres/universal.git/GPII-795..HEAD
返回:
fatal: Invalid object name 'https'.
How can I do the same instead of
origin
using apath/to/github/repo.git
?
git diff https://github.com/malarres/universal.git/GPII-795..HEAD
那不是 git diff
的工作方式。如果你想区分你的本地仓库和另一个仓库,你需要执行以下操作:
将后者添加为前者的远程。请注意,除了
origin
之外,没有什么能阻止您在一个存储库中定义多个遥控器。 (不过,您可能希望选择一个比“其他”更不通用的远程名称。)git remote add other https://github.com/malarres/universal.git/GPII-795
从远程获取所有内容:
git fetch other
运行 适当的
git diff
命令,例如,git diff other/master..HEAD
如果您稍后想从您的存储库中删除该遥控器,您可以运行
git remote rm other