当前位置:   article > 正文

有效的避免代码提交冲突,有效的避免git提交冲突_减少代码冲突的有效有段

减少代码冲突的有效有段
Microsoft Windows [版本 10.0.17763.1577]
(c) 2018 Microsoft Corporation。保留所有权利。

D:\work\HCC\platform>git pull
warning: redirecting to https://sys-gitlab.hikvision.com.cn/IPSC/web/Bumblebee/platform.w/platform.git/
Updating 202ec548..f044c9b1
Fast-forward
 .../libs/jsWebControl/jsWebControl-1.0.0.min.js    | 29806 ++++++++++++++++++-
 src/Common/vue/service/router/pathNameRule.js      |    18 +-
 .../image/common/common_status_fail_grey.svg       |     7 +
 .../vue/assets/less/hcc-icomoon/fonts/icomoon.eot  |   Bin 322400 -> 323472 bytes
 .../vue/assets/less/hcc-icomoon/fonts/icomoon.svg  |     4 +
 .../vue/assets/less/hcc-icomoon/fonts/icomoon.ttf  |   Bin 322236 -> 323308 bytes
 .../vue/assets/less/hcc-icomoon/fonts/icomoon.woff |   Bin 322312 -> 323384 bytes
 .../vue/assets/less/hcc-icomoon/style.css          |    22 +-
 src/HCCCommon/vue/assets/less/icons.less           |     4 +
 src/HCCCommon/vue/components/AreaTree.vue          |    21 +-
 src/HCCCommon/vue/components/Drawer.vue            |     9 +-
 src/HCCCommon/vue/connect/vsm.connect.ts           |     2 +
 src/HCCCommon/vue/http/isapi.js                    |     4 +-
 src/HCCCommon/vue/libs/webControlDowload.js        |   156 +-
 src/HCCCommon/vue/service/router/pathNameRule.js   |  3104 +-
 src/HCCCommon/vue/webcontrol/LocalFilePlayBack.vue |     2 +-
 src/HCCCommon/vue/webcontrol/PreviewControl.vue    |     2 +-
 .../libs/jsWebControl/jsWebControl-1.0.0.min.js    | 29794 +++++++++++++++++-
 18 files changed, 60128 insertions(+), 2827 deletions(-)
 create mode 100644 src/HCCCommon/vue/assets/image/common/common_status_fail_grey.svg

D:\work\HCC\platform>cd src/hccportal

D:\work\HCC\platform\src\HCCPortal>git puyll
git: 'puyll' is not a git command. See 'git --help'.

The most similar command is
        pull

D:\work\HCC\platform\src\HCCPortal>git pull
error: Your local changes to the following files would be overwritten by merge:
        assets/static/i18n/en/label.json
        assets/static/i18n/zh_CN/label.json
Please commit your changes or stash them before you merge.
Aborting
Updating ede86b8..0f0c936

D:\work\HCC\platform\src\HCCPortal>
D:\work\HCC\platform\src\HCCPortal>git pull
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), 636 bytes | 2.00 KiB/s, done.
From https://sys-gitlab.hikvision.com.cn/IPSC/web/Bumblebee/hccportal/hccportal
   0f0c936..890914b  master     -> origin/master
Updating files: 100% (25/25), done.
Updating ede86b8..890914b
Fast-forward
 assets/img/android.svg                    |     1 +
 assets/img/bg_cube_hcc_VMS.png            |   Bin 378872 -> 324819 bytes
 assets/img/bg_cube_hcc_vehicle.png        |   Bin 409489 -> 350128 bytes
 assets/img/common_feedback_warning_sm.svg |     7 +
 assets/img/image_cloud_car_bg.svg         |   446 +
 assets/img/image_cloud_car_sm.svg         |   432 +
 assets/img/image_cloud_video_bg.svg       |   335 +
 assets/img/image_cloud_video_sm.svg       |   321 +
 assets/img/ios.svg                        |     1 +
 assets/static/favicon.ico                 |   Bin 0 -> 13054 bytes
 assets/static/i18n/en/huiLan.json         |     4 +-
 assets/static/i18n/en/label.json          | 26189 ++++++++++++++--------------
 assets/static/i18n/en/msg.json            |  8612 +++++----
 assets/static/i18n/zh_CN/huiLan.json      |     4 +-
 assets/static/i18n/zh_CN/label.json       | 26079 +++++++++++++--------------
 assets/static/i18n/zh_CN/msg.json         |  8616 +++++----
 buryPoint/index.js                        |    28 +-
 common/header/BaseHeader.vue              |    37 +-
 view/home/CameraItem.vue                  |     3 +
 view/home/CarItem.vue                     |     3 +
 view/home/DeviceOverrunTips.vue           |    89 +
 view/home/HCCHome.vue                     |  1791 +-
 view/home/PackageChoose.vue               |     8 +-
 view/home/QuickEntryList.vue              |     2 +-
 view/login/Login.vue                      |   210 +-
 25 files changed, 37624 insertions(+), 35594 deletions(-)
 create mode 100644 assets/img/android.svg
 create mode 100644 assets/img/common_feedback_warning_sm.svg
 create mode 100644 assets/img/image_cloud_car_bg.svg
 create mode 100644 assets/img/image_cloud_car_sm.svg
 create mode 100644 assets/img/image_cloud_video_bg.svg
 create mode 100644 assets/img/image_cloud_video_sm.svg
 create mode 100644 assets/img/ios.svg
 create mode 100644 assets/static/favicon.ico
 create mode 100644 view/home/DeviceOverrunTips.vue

D:\work\HCC\platform\src\HCCPortal>git push
To https://sys-gitlab.hikvision.com.cn/IPSC/web/Bumblebee/hccportal/hccportal.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://sys-gitlab.hikvision.com.cn/IPSC/web/Bumblebee/hccportal/hccportal.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

D:\work\HCC\platform\src\HCCPortal>git pull
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 7 (delta 6), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), 614 bytes | 2.00 KiB/s, done.
From https://sys-gitlab.hikvision.com.cn/IPSC/web/Bumblebee/hccportal/hccportal
   890914b..1e7efeb  master     -> origin/master
Auto-merging assets/static/i18n/en/label.json
Merge made by the 'recursive' strategy.
 assets/static/i18n/en/label.json | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

D:\work\HCC\platform\src\HCCPortal>git push
Enumerating objects: 45, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 6 threads
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 39.76 KiB | 6.63 MiB/s, done.
Total 21 (delta 17), reused 0 (delta 0)
To https://sys-gitlab.hikvision.com.cn/IPSC/web/Bumblebee/hccportal/hccportal.git
   1e7efeb..5a6dffb  master -> master

D:\work\HCC\platform\src\HCCPortal>
  • 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
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126

第一:

git pull 一下,然后可以看到警告信息(可以看到具体是哪些文件冲突,然后对比找出具体是那个位置出现冲突,然后将改动的代码复制出去,然后将本地代码的修改给还原):

D:\work\HCC\platform\src\HCCPortal>git pull
error: Your local changes to the following files would be overwritten by merge:
        assets/static/i18n/en/label.json
        assets/static/i18n/zh_CN/label.json
Please commit your changes or stash them before you merge.
Aborting
Updating ede86b8..0f0c936
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

第二,再次执行,git pull (这样就可以顺利的拉取到最新的代码):

第三,将自己改动的代码给复制进去。

第四,就可以进行代码提交操作了。

很多人都是git add . git commit -m “” 然后git push 之后发现代码冲突了,gg,上述的解决很有效

------------------------------------------------------------上一阶段结束-----------------------------------------------------

当然当你 执行 git add . —> git commit -m" " ----> git push 之后会报错 会建议你使用git pul

PS F:\_practice\practice_git_order> git push
To github.com:imkf-zhang/practice_git_order.git
 ! [rejected]        zkf-fz -> zkf-fz (fetch first)
error: failed to push some refs to 'git@github.com:imkf-zhang/practice_git_order.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

git pull 之后编辑器就会出现如下(Accept的不要选,只要选了就不可逆了(指的是最终以那种方案为准),可以选择Compare Canges看看差异):
在这里插入图片描述
------------------------------------------------------------上一阶段结束-----------------------------------------------------
注意地方:

git pull 指的是你本地改变了文件,并且保存(ctrl + s)了,这个改变的文件和远程仓库冲突了然后导致git pull不成功

本地仓库上次git pull 之后,然后又有人往远程仓库推送代码了,但是本地仓库你本身并没有做什么改变,那么此时你去git pull 是可以成功

git pull 会把没有冲突的文件跟远程仓库更新,但是有冲突的就不回更新 这个观点是错误的 × 会都不更新

------------------------------------------------------------上一阶段结束-----------------------------------------------------
vscode 中对于git的操作:

其实vscode中对于git的操作,只是优化了 ==git add ~ ; git commit -m""==的操作,然后还需要打开git面板进行git push操作。
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小桥流水78/article/detail/806665
推荐阅读
相关标签
  

闽ICP备14008679号