我如何在我的回购和远程回购之间进行区分?

时间:2015-01-16 08:20:38

标签: git github

来自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'.

1 个答案:

答案 0 :(得分:6)

  

如何使用origin

而不是path/to/github/repo.git而不是git diff https://github.com/malarres/universal.git/GPII-795..HEAD      

git diff

这不是origin的工作方式。如果您想在本地仓库和另一个仓库之间进行区分,则需要执行以下操作:

  1. 将后者添加为前者的远程。请注意,除了git remote add other https://github.com/malarres/universal.git/GPII-795 之外,没有什么可以阻止您在一个存储库中定义多个远程数据库。 (但是,您可能希望选择比“其他”更不通用的远程名称。)

    git fetch other
    
  2. 从该遥控器中获取所有内容:

    git diff
  3. 运行相应的git diff other/master..HEAD 命令,例如

    git remote rm other
    
  4. 如果您以后想要从存储库中删除该远程,则可以运行

    {{1}}
相关问题