【发布时间】:2012-08-09 17:25:27
【问题描述】:
我已经从 git 克隆了存储库 A 的 master 分支,并创建了我自己的名为 Li 的分支。 我前段时间做了一些改动,将本地李的内容推送到远程李。
现在我已经将一些更新从远程 master 拉到本地 master 分支,从本地 master 分支拉到本地 Li,我正在尝试将更新从本地 Li 推送到远程 Li。 但是,当我尝试运行时:
git checkout Li
git push origin Li
我收到以下错误:
error: failed to push some refs to 'git@github.com:anodejs/system.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
请注意,我的本地 master 分支已更新(我调用了 git pull origin master)并合并到本地 Li 分支。但是,我确实为本地 Li 添加了一个新文件,因此本地 Li 与本地 master 不完全相同(但这应该没关系,对吧?)
谢谢, 李
【问题讨论】:
-
在尝试推送之前,您是否在 Li 分支上提交了更改?
-
带着同样的问题来到这个问题,这里的答案没有帮助。原来我的问题是我不在分支机构 - 请参阅 stackoverflow.com/a/18601467/5002633 了解我如何诊断/修复它。