您的位置:首页 > 其它

解决git版本冲突

2017-12-14 19:34 363 查看

场景:

$ git push test master
To gitee.com:yoyhm/git.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitee.com:yoyhm/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.


解决办法:

## 1. 产生版本冲突,将远程的pull到本地
$ git pull origin master
## 如果出现以下问题
## ------------------------
$ git pull test master
From gitee.com:yoyhm/git
* branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories
## ------------------------------
## 解决上面问题
## ------
$ git merge test/master --allow-unrelated-histories
## ------

## 2. 再次推送即可
$ git push -u test master
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: