从查看Unpushed Git提交我知道如何在我自己的repo和我的本地提交之间进行差异:
git diff origin/master..HEAD
Run Code Online (Sandbox Code Playgroud)
但是,我怎样才能使用相同而不是原点path/to/github/repo.git?
git diff https://github.com/malarres/universal.git/GPII-795..HEAD
Run Code Online (Sandbox Code Playgroud)
正在回归:
fatal: Invalid object name 'https'.
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做而不是
origin使用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
Run Code Online (Sandbox Code Playgroud)从该远程获取所有内容:
git fetch other
Run Code Online (Sandbox Code Playgroud)git diff例如,运行适当的命令
git diff other/master..HEAD
Run Code Online (Sandbox Code Playgroud)如果您以后想要从存储库中删除该远程,则可以运行
git remote rm other
Run Code Online (Sandbox Code Playgroud)