How to solve conflicts while pulling a branch from a remote repository?

70 Views Asked by At

I am currently working on a project that involves forking a specific GitHub repository. In my forked version, I am required to incorporate a branch named windows into my project. The original main branch is designed for the Linux operating system, whereas the windows branch is intended for Windows, which is the operating system I am using. However, I have encountered unexpected issues when attempting to pull the windows branch, and I am unsure of the underlying cause.

To provide some context, I have included the command prompt text demonstrating the process of forking the original repository and cloning it onto my local machine. Additionally, I have cloned the vcpkg repository to my computer, although it is unrelated to the current issue. Subsequently, I performed a fetch to acquire the desired branch (windows). Regrettably, problems arose when I attempted to execute the pull operation for this branch.

I would greatly appreciate any insights or suggestions regarding a resolution for this issue. It is important to note that I did not open the code anywhere prior to performing the fetch and pull actions for the windows branch, and I can confirm this with certainty.

Command Prompt Text:

C:\Users\mhmds>git clone https://github.com/MohamadShaheen/simulatorMapping.git
Cloning into 'simulatorMapping'...
remote: Enumerating objects: 1385, done.
remote: Counting objects: 100% (314/314), done.
remote: Compressing objects: 100% (65/65), done.
remote: Total 1385 (delta 269), reused 275 (delta 249), pack-reused 1071
Receiving objects: 100% (1385/1385), 73.09 MiB | 3.06 MiB/s
Receiving objects: 100% (1385/1385), 73.67 MiB | 3.79 MiB/s, done.
Resolving deltas: 100% (631/631), done.

C:\Users\mhmds>git clone https://github.com/microsoft/vcpkg.git
Cloning into 'vcpkg'...
remote: Enumerating objects: 199719, done.
remote: Counting objects: 100% (14950/14950), done.
remote: Compressing objects: 100% (407/407), done.
remote: Total 199719 (delta 14661), reused 14641 (delta 14543), pack-reused 184769
Receiving objects: 100% (199719/199719), 64.29 MiB | 2.99 MiB/s, done.
Resolving deltas: 100% (130594/130594), done.
Updating files: 100% (10349/10349), done.

C:\Users\mhmds>cd simulatorMapping

C:\Users\mhmds\simulatorMapping>git fetch https://github.com/rbdlabhaifa/simulatorMapping.git windows:windows
remote: Enumerating objects: 221, done.
remote: Counting objects: 100% (221/221), done.
remote: Compressing objects: 100% (46/46), done.
Receiving objects:  89% (126/141), 190.18 MiB | 1.82 MiB/sreused 0
Receiving objects: 100% (141/141), 190.46 MiB | 2.91 MiB/s, done.
Resolving deltas: 100% (95/95), completed with 66 local objects.
From https://github.com/rbdlabhaifa/simulatorMapping
 * [new branch]      windows    -> windows

C:\Users\mhmds\simulatorMapping>git pull https://github.com/rbdlabhaifa/simulatorMapping.git windows:windows
Auto-merging CMakeLists.txt
CONFLICT (content): Merge conflict in CMakeLists.txt
Auto-merging Thirdparty/DBoW2/DBoW2/TemplatedVocabulary.h
Auto-merging exe/CMakeLists.txt
CONFLICT (add/add): Merge conflict in exe/CMakeLists.txt
Auto-merging exe/runSimulator.cpp
CONFLICT (content): Merge conflict in exe/runSimulator.cpp
Auto-merging install.sh
CONFLICT (content): Merge conflict in install.sh
Auto-merging slam/src/LoopClosing.cc
CONFLICT (content): Merge conflict in slam/src/LoopClosing.cc
Auto-merging slam/src/System.cc
CONFLICT (content): Merge conflict in slam/src/System.cc
Auto-merging utils/include/Auxiliary.h
Auto-merging vcpkg.json
CONFLICT (add/add): Merge conflict in vcpkg.json
Automatic merge failed; fix conflicts and then commit the result.

Thank you for your assistance.

1

There are 1 best solutions below

0
phd On
git pull <URL> windows:windows

means git fetch <URL> windows:windows and then git merge windows into the current branch. The current branch is main because it's the default branch for both repositories you fetched/pulled; after a fresh clone it's what Git checked out. The merge into main is probably not what you want. I believe you want to pull branch windows having it as the current branch. So first checkout the branch and then pull:

git checkout windows
git pull <URL> windows