为什么即使我拉了之后我的推动也被拒绝了?

时间:2012-01-16 09:54:05

标签: git

$ git branch
  master
* portal
$ git fetch
$ git merge origin/portal
Already up-to-date.
$ git pull
Already up-to-date.
$ git push
To git@github.com:ripper234/Commerce-Sciences.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:ripper234/Commerce-Sciences.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

通常我会做一个gitk -all试试看看到底发生了什么,但这是在一个没有图形外壳的Linux机器上。

1 个答案:

答案 0 :(得分:5)

请注意以下错误消息:

! [rejected]        master -> master (non-fast-forward)

您合并了portal个分支,但您还试图推送master,因为git push默认会尝试推送{{1}上也存在的所有分支}}。试试这个:

origin