2

When I use the merge command, the conflicting lines will be marked and I can go and choose the master or merged version by editing the file in editor and then 'git add '.

What I want is to merge and then have a comment (similar to the comment I get when two files conflict), like this:

<<<<<<< HEAD
  The old line in my old file in master branch
=======
  The new line in my merged branch
>>>>>>>  

I want the above like comment even if there is no conflict. It helps me to manually start editing and decide what to be merged and what to be discarded.

Basically I need to have control over merge line by line after I merged the branch.

Dr. Ehsan Ali
  • 4,735
  • 4
  • 23
  • 37
  • 1
    I don't get what you want to achieve. Maybe you can visualize it a bit more? 'What I want is to merge and then have that comment in my files after merge' -> That makes no sense basically, you don't have 'commits in your files'. Please clarify your question a bit. – ckruczek Aug 31 '15 at 05:18
  • Ok I tried to clarify more. – Dr. Ehsan Ali Aug 31 '15 at 05:27

1 Answers1

1

I need to have control over merge line by line after I merged the branch.

You could try and have control during a merge, not after.
After, all you could do is a diff, in order to check what has been merged.

(That is what the OP Ehsan mentions in the comments:

I solved the problem by merging first and then using diff tool to see the changes against the older version

)

If there are conflicts, you will have the opportunity to decide what to be merged (merge markers)

But if there are no conflicts, then those "comments" would simply be the result of the merge (the line added/removed or modified)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I see. So I can not keep a 'merge marker' in my merged files for non-conflicting parts to be included AFTER merge? – Dr. Ehsan Ali Aug 31 '15 at 06:18
  • 1
    Exactly: if the merge has no conflict, the "marker" would simply be identical to the end result, to the resulting merged line. – VonC Aug 31 '15 at 06:20
  • Ok I solved the problem by merging first and then using diff tool to see the changes against the older version. That worked.Should I accept your answer as the correct one? I guess it is just a workaround. I still feel there must be a hidden option for the kind of behavior that I am looking for. – Dr. Ehsan Ali Aug 31 '15 at 10:55
  • @Ehsan Yes, I have edited the answer to include your conclusion. – VonC Aug 31 '15 at 10:57