Git reshape conflict so nothing merges?

What does this mean that when you switch git, a conflict is detected, but there is no obvious problem in the file? There are no conflict markers in the file in question, and git mergetool says "nothing merges."

I have reset or add options:

 # Unmerged paths: # (use "git reset HEAD <file>..." to unstage) # (use "git add/rm <file>..." as appropriate to mark resolution) # # both modified: filename.js 

How to find out what it means and which way to take?

git ls-files -s filename.js gives 3 lines:

 100644 d2c915b1d632b8ef8fbcf056824fb7fac7824ab9 1 filename.js 100644 9010798f1d19ac712196b1fc9b0870fd332b1275 2 filename.js 100644 b3ab7ec50812c73a3ec97bf0985f3226ec13cbc8 3 filename.js 

In accordance with the excellent guidance, this command tells us the mode bits, object name and stage number. The mode bits are the same. So, what are 1, 2, and 3, and why are they β€œboth changed,” but do not display conflict markers?

+6
source share
2 answers

The versions in the index marked 1 , 2 and 3 have the following meanings:

  • You merge a file that was in the common ancestor of the two commits.
  • A file that was in HEAD , i.e. your current commit when you did the merge.
  • The file as is in the commit that you are trying to merge into HEAD .

The source of this information is the git conflict resolution help section .

The output of both modified in git status indicates, of course, that the file has been modified in different ways by the two commits that you combine with their common ancestor.

It’s rather mysterious for me why you don’t see conflict markers in the file, however, that blobs have different object names (hashes) on the output of git ls-files -s , it indicates that bytes they do bytes bytes, of course, have different content. If you are happy with the file, as in your working copy, you can just do git add filename.js and then git rebase --continue . However, in any case, you may need to find out what the difference is. To do this, I will try the following:

 git diff :2:filename.js filename.js 

... which will show the differences between the version in HEAD and the current working copy. Similarly, you can try:

 git diff :3:filename.js filename.js 

... to see the difference between the version in it and your working copy.

+7
source

1 , 2 and 3 of git ls-files -s represents the β€œstage” of a three-way merge : 1 is a common ancestor, 2 is the current HEAD branch, and 3 is the other HEAD branch. On Linux, you can try the following commands to see what is different from files:

 $ git cat-file blob d2c915b1d632b8ef8fbcf056824fb7fac7824ab9 | xxd -ps $ git cat-file blob 9010798f1d19ac712196b1fc9b0870fd332b1275 | xxd -ps $ git cat-file blob b3ab7ec50812c73a3ec97bf0985f3226ec13cbc8 | xxd -ps 
+1
source

Source: https://habr.com/ru/post/900158/


All Articles