$ 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机器上。
答案 0 :(得分:5)
请注意以下错误消息:
! [rejected] master -> master (non-fast-forward)
您合并了portal
个分支,但您还试图推送master
,因为git push
默认会尝试推送{{1}上也存在的所有分支}}。试试这个:
origin