最近使用git命令将本地仓库的代码推送到GitHub时,出现以下问题:
To https://github.com/xxxx/git.git
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to 'https://github.com/xxxx/git.git'
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.
使用以下方法解决该问题(根据提示再push之前,应该先使用pull命令):
git fetch origin
git merge origin dev
git pull origin dev
git push origin dev
网友评论