Effectively avoid code commit conflicts, effectively avoid git commit conflicts

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>

First:

git pull, then you can see the warning message (You can see the specific file conflicts, and then compare and find out the specific location where the conflict occurs, then copy the changed code out, and then restore the local code modification):

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

Second, do it again, git pull (In this way, you can smoothly pull to the latest code):

Third, copy the code you changed into it.

Fourth, the code submission operation can be performed.

Many people are git add . git commit -m "" and then git push and find that the code conflicts, gg, the above solution is very effective

-------------------------------------------------- ----------End of previous stage------------------------------------ -----------------

Of course, when you execute git add . —> git commit -m" " ----> git push, an error will be reported and you will be advised to use 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 '[email protected]: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.

After git pull, the editor will appear as follows (Don't choose Accept, as long as you choose it is irreversible (referring to the final plan), you can choose Compare Canges to see the difference):
insert image description here
------------------------------------------------ ------------End of previous stage----------------------- -------------------
Note places:

git pull means that you have changed the file locally and saved (ctrl + s),This changed file conflicts with the remote repositorythen cause git pull to be unsuccessful

After the last git pull of the local warehouse, someone pushed the code to the remote warehouse, but you have not made any changes in the local warehouse, then you can successfully go to git pull at this time.

git pull will update the files without conflict with the remote repository, but will not update if there are conflictsThis view is wrong× will not be updated

-------------------------------------------------- ----------End of previous stage------------------------------------ -----------------
git operations in vscode:

In fact, the operation of git in vscode only optimizes the operation of ==git add ~; git commit -m""==, and then you need to open the git panel for git push operation.
insert image description here

Guess you like

Origin blog.csdn.net/weixin_43131046/article/details/123261435