【发布时间】:2015-12-30 23:17:19
【问题描述】:
我对 Git 很陌生,因此在正确使用它时遇到了一些问题。 这是我的场景。
我有一个主存储库的分支并将其克隆到我的本地。 在那,我有 2 个分支用于不同的修复。
当我提交时,我在 git 中看到了一条语句——我们说我提前 3 次提交,落后大约 20 次提交。
我了解我的 fork 与 master 不同步。我也需要合并这两个分支(或者我应该这样做吗?)
我使用 windows 客户端进行同步。但似乎我没有遵循 Git 的方式。所以,我尝试按照https://help.github.com/articles/syncing-a-fork/ 中描述的步骤操作,这给了我如下错误(我正在使用 Windows)。
$>git fetch upstream
fatal: 'upstream' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我有点困惑。 请帮助我完成在这种情况下应该遵循的步骤。
@HuStmpHrrr
很抱歉在 cmets 中添加了详细信息 为了便于阅读,我将修改问题
通过执行命令:
$>git remote returning two values
acme-development (which the name of my actual/main repository, from where I forked) and
origin
添加更多信息。
但是,如果我登录到我的 Github 在线帐户,那就是另一回事了。
我的 git 客户端说 本地 repo 是最新的。 但是网上的 git 说我们落后了 42 个提交,提前了 7 个提交。
【问题讨论】:
-
你是怎么
clone的?我猜你的意思是git fetch origin。如果您定义了上游,则单独使用git fetch即可。或者大多数人实际上更喜欢git pull。 -
我认为您需要向我们展示
git remote。 -
$>git remote acme-development 起源
-
不要将其粘贴在评论中,而是粘贴在您的问题中。所以你有两个遥控器,
acme-development和origin。我敢打赌它是origin。改为git fetch origin。