更新时间:2022-10-15 16:59:17
我该怎么办使用
$ b $来代替路径/ to / github / repo.git
?origin
b
git diff https://github.com/malarres/universal.git/GPII-795..HEAD
这不是 git diff
的工作方式。如果您想区分当地回购和其他回购,您需要执行以下操作:
将后者添加为前者的 remote 。请注意,在一个存储库中,除了 origin
之外,没有什么能够阻止您定义多个远程。 (但是,您可能希望选择一个不太通用的远程名称)。
git remote add other https:/ /github.com/malarres/universal.git/GPII-795
remote:
git fetch other
运行相应的 git diff
命令,例如,
$ b $ / $>
如果您稍后想要从存储库中删除该远程设备,则可以运行
git remote rm other
From Viewing Unpushed Git Commits I know how to make diff between a repo on my own and my local commits:
git diff origin/master..HEAD
But, 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
is returning:
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
That's not the way git diff
works. If you want to diff between your local repo and another repo, you need to do the following:
Add the latter as a remote of the former. Note that nothing prevents you from defining multiple remotes, in addition to origin
, within one repository. (You may want to choose a less generic remote name than "other", though.)
git remote add other https://github.com/malarres/universal.git/GPII-795
Fetch everything from that remote:
git fetch other
Run the appropriate git diff
command, for instance,
git diff other/master..HEAD
If you later want to remove that remote from your repository, you can run
git remote rm other