【发布时间】:2015-01-15 01:58:48
【问题描述】:
我习惯使用 SVN,最近才切换到 GitHub。
我正在尝试更新 GitHub 存储库中的一些文件,但收到以下消息:
To https://github.com/.../
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/.../'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我已经尝试过像git fetch origin 和git pull 这样的命令,但是这些都没有成功,所以我当前的分支并不落后。
在 SVN 中,我只需执行 svn update,然后提交我的更改。
我也试过git pull origin,但我收到一条奇怪的短信,我不知道如何与之交互:Updating a local repository with changes from a Github repository
【问题讨论】:
-
通常
git pull将合并来自远程的提交,这样您的分支就不会落后并允许您推送。git remote -v和git branch -vv的输出是什么? -
我通过克隆和复制我的更改手动修复它。我之前尝试过
git pull,但它要求澄清我从中提取的分支名称。如果我这样做git pull origin,则会打开一个类似 EMAC 的文件,要求解释我为什么要合并。