Understanding and Handling Merge conflict in Git #422
Replies: 2 comments 14 replies
-
@ninimama Are you able to upload the notebook here (not Copy/Paste - just drag and drop the file in a comment box)? |
Beta Was this translation helpful? Give feedback.
-
It contains two files: one of them is the version I have on my local repo (before |
Beta Was this translation helpful? Give feedback.
-
I am trying to understand merge conflict and how to handle it. I read atlasian guide and also watch youtube and read articles online.
In most cases, the conflict is easy to detect. For instance, a few lines are modified/updated and it is visually easy to understand that by looking at the file that include merge conflict marker.
However, there are a lot of metadata in jupyter notebook when merge conflicts exist. I opened the notebook in a JSON editor (please see below where I copied only a part of the notebook )
Is that a typical thing in resolving merge conflicts?!
Because it is really messy and hard to understand what has been changed. Even an image/png is shown as a lot of characters. I copied a small part of it below:
============================================================
So, I took a different approach. I decided to copy my notebook file somewhere else. Then, I deleted it from
Snippets_Tutorial
branch (let's call itST
here) of my local repo (by usinggit rm <file>
). I thought that I could do merge with no conflict as there is no such file in the 'ST' and it can be fetched and merged from originSnippets_Tutorial
. But, again, I got merge conflict after runninggit pull origin Snippets_Tutorial
! No idea why!Then, I decided to take another approach! I copy back my tutorial notebook to my local repo while I was at
Snippets_Tutorial
branch. This time, I decided to delete the cells inside my notebook. In other words, instead of deleting the notebook, I deleted the cells. Now, I think there should be no conflict for merge by runninggit pull origin Snippets_Tutorial
. But, I was wrong. I got conflict message!!======================================================================================
To sump up, this is what I can understand:
At local repo, I created Snippets_branch. I did some changes and then did pull request. Then, origin repo accepts this PR and this branch will be appeared there.
(1) However, I cannot find such branch on Stumpy repo (original repo)
Now, the owner or any other contributor made some changes to the file. This file is the one to which they have access through the Snippets_Tutotrial branch. That is the branch created after I did Pull Request in the first place. Right?
(2) How can I see the content of this file? Because I cannot pull that file into my Snippets_Tutorial branch before resolving the conflicts. I cannot see it through the origin repo avaialble on GitHub. If fact, the only branch of the origin repo is
main
.======================================================================
I hope I explained things clearly. If not and further elaboration is required, please let know.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions