提交冲突解决
一、将本地文件修改后push到远程分支有时会出现 devlops|MERGING
1
2
3
4
5
6
7
8
9
10
11
12
13
|
git add . git commit -m "feat:优惠券功能" git pull ........... (devlops|MEARGE) git add . git commit -m "feat:优惠券" git push |
二、push的时候出现rejected
1
2
3
4
5
6
7
8
9
10
11
|
$ git push -u origin branchName To https: //gitlab.hangjia.online/changqing/vue-node.git ! [rejected] case -> case (non-fast-forward)<br> 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<br> $ git push -u origin branchName -f |
三、本地分支拉去远程分支 pull 的时候会出现 fatal:refusing to merge unrelated histories
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// 克隆远程分支 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 |
漫思