提交冲突解决

一、将本地文件修改后push到远程分支有时会出现  devlops|MERGING

 

git add .

git commit -m "feat:优惠券功能"

git pull

........... (devlops|MEARGE)

git add .

git commit -m "feat:优惠券"

git push

 

 

二、push的时候出现rejected

$ git push -u origin branchName

To https://gitlab.hangjia.online/changqing/vue-node.git
 ! [rejected]        case -> case (non-fast-forward)
error: failed to push some refs to 'https://gitlab.hangjia.online/changqing/vue-node.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
$ git push -u origin branchName -f

  

 三、本地分支拉去远程分支 pull 的时候会出现  fatal:refusing to merge unrelated histories

 

// 克隆远程分支

git clone https:(ssh)..........

// 创建并切换分支

git checkout  BranchName

// 拉去远程分支 到本地

git pull

fatal: refusing to merge unrelated histories

// 出现fatal 由于远程仓库 认为是两个不相干的仓库,相当于远程merge到本地 则需要强制下来

git pull origin BranchName  --allow-unrelated-histories

// 出现如下 有冲突,修改次文件
CONFLICT (add/add): Merge conflict in README.md

git add .

git commit -m "commit"

git pull

// 此时分支所有文件下拉完成 如果修改的 修改后即可 push

 

  

 

posted @ 2020-07-29 11:11  红妆  阅读(267)  评论(0编辑  收藏  举报