Git uploads (when local and remote have conflicts)

Source: Internet
Author: User
Tags git mergetool

I. Conflict generation: Both local and remote have changed since the last git sync (upload)

Two. Handling

1. Discard local, using remote:

Git checkout conflicting files and their paths

such as: Git checkout bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp

2. Man-made merge (git mergetool) local and Remote code (IDEA: Commit a conflict-free section, then merge, commit the conflict, and finally push all the changes)

1). Git Pull: prompt conflict

2). Commit (git add--all; git commit)

3). Git pull

4). Git mergetool

5). Git pull
6). Git commit
[216-fixed-area-walk D228a46] Merge branch ' 216-fixed-area-walk ' of 192.168.1.51:IGV/IGV01-SW into 216-fixed-area-walk

7). Git add--all
8). Git commit
9). Git Push Origin 216-fixed-area-walk

The following is the actual operation of Scenario 2:

[Email protected]:~/igv01-sw$ git pull
Updating 502a546. 9d49eeb
Error:your local changes to the following files would is overwritten by merge:
Bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp
Please, commit your changes or stash them before you can merge.
Aborting
[Email protected]:~/igv01-sw$ git add--all
[Email protected]:~/igv01-sw$ git commit
[216-fixed-area-walk C8fd2d7] Add a feasible zone requestor
Files changed, 167 insertions (+), deletions (-)
Create mode 100644 Bzrobot_atom_tasks/bzrobot_require_access_area/cmakelists.txt
Create mode 100644 bzrobot_atom_tasks/bzrobot_require_access_area/include/bzrobot_require_access_area/require_ Access_area.h
Create mode 100644 Bzrobot_atom_tasks/bzrobot_require_access_area/launch/bzrobot_require_access_area.launch
Create mode 100644 Bzrobot_atom_tasks/bzrobot_require_access_area/package.xml
Create mode 100644 Bzrobot_atom_tasks/bzrobot_require_access_area/src/require_access_area.cpp
[Email protected]:~/igv01-sw$ git pull
Auto-merging Bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp
CONFLICT (content): Merge CONFLICT in Bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp
Automatic merge failed; Fix conflicts and then commits the result.
[Email protected]:~/igv01-sw$ git mergetool

This message is displayed because ' Merge.tool ' are not configured.
See ' Git mergetool--tool-help ' or ' git help config ' for more details.
' Git Mergetool ' would now attempt-use one of the following tools:
Meld Opendiff kdiff3 Tkdiff xxdiff tortoisemerge gvimdiff diffuse diffmerge ecmerge p4merge araxis BC3 Codecompare emerge Vimdiff
Merging:
Bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp

Normal merge conflict for ' Bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp ':
{Local}: Modified file
{Remote}: Modified file
Hit return to start Merge Resolution tool (MELD):
[Email protected]:~/igv01-sw$ git pull
You have a not concluded your merge (Merge_head exists).
Please, commit your changes before you can merge.
[Email protected]:~/igv01-sw$ git commit
[216-fixed-area-walk D228a46] Merge branch ' 216-fixed-area-walk ' of 192.168.1.51:IGV/IGV01-SW into 216-fixed-area-walk
[Email protected]:~/igv01-sw$ git pull
Already up-to-date.

[Email protected]:~/igv01-sw$ git add--all
[Email protected]:~/igv01-sw$ git commit
[216-fixed-area-walk 44A25FF] modifying class naming
4 files changed, insertions (+), deletions (-)
[email protected]:~/igv01-sw$ git push origin 216-fixed-area-walk

Counting objects:186, done.
Delta compression using up to 4 threads.
Compressing objects:100% (62/62), done.
Writing objects:100% (70/70), 6.38 KiB | 0 bytes/s, done.
Total (delta), reused 0 (Delta 0)
to [email protected]:igv/igv01-sw.git
9d49eeb. 44A25FF 216-fixed-area-walk-216-fixed-area-walk

Three. General operating procedures for uploading updates to 216 branches from 216 branches

1. Git pull

2. Git add--all

3. Git commit

4. Git push Origin 216-fixed-area-walk

Git uploads (when local and remote have conflicts)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.