本地和远程存储库之间的区别?
Diff between local and remote repositories?
我从 github 中的一个组织分叉了一个 repo,并在本地做了一些更改并推送了它们,这些更改反映在我帐户上的分叉副本中,而不是组织帐户上的原始副本中。
如何在本地比较这两个存储库并将它们合并在一起。
假设我可以访问原始存储库。
你应该使用 remote
s:
git remote add upstream https://path-to-original.repo
请注意,名称 upstream
可以是您喜欢的任何名称。后加一个remote
,运行git fetch upstream
helps you:
Fetch branches and/or tags (collectively, "refs") from one or more
other repositories, along with the objects necessary to complete their
histories.
fetch
是必需的,例如,如果您没有 upstream
.
的某些分支
现在你可以拉(假设你在同一个分支)使用:
git push upstream master
现在比较你的 master
和远程的 master
你会写类似 this:
git diff master upstream/master
您可以使用以下方式列出所有 remote
s:
git remote -v
我从 github 中的一个组织分叉了一个 repo,并在本地做了一些更改并推送了它们,这些更改反映在我帐户上的分叉副本中,而不是组织帐户上的原始副本中。
如何在本地比较这两个存储库并将它们合并在一起。
假设我可以访问原始存储库。
你应该使用 remote
s:
git remote add upstream https://path-to-original.repo
请注意,名称 upstream
可以是您喜欢的任何名称。后加一个remote
,运行git fetch upstream
helps you:
Fetch branches and/or tags (collectively, "refs") from one or more other repositories, along with the objects necessary to complete their histories.
fetch
是必需的,例如,如果您没有 upstream
.
现在你可以拉(假设你在同一个分支)使用:
git push upstream master
现在比较你的 master
和远程的 master
你会写类似 this:
git diff master upstream/master
您可以使用以下方式列出所有 remote
s:
git remote -v