user3354539
user3354539

Reputation: 1245

TortoiseHG merge with local

I am new to mercurial, and I am having trouble understanding resolving conflicts when I attempt to merge with the local branch.

I have a repository that a 3rd party has pushed changes to.

I committed my changes and then pulled the changes by the 3rd party - as advised by TortoiseHG.

When I tried to merge with local, I have the following screen asking me to resolve the conflicts:

enter image description here

I am really uncertain what to do here.

What option do I select to merge the pushed 3rd party files to my local files and also keep my committed changes?

This may be a ridiculously simple question to ask, but I am concerned that I will make the wrong selection and overwrite the wrong files, which I have seen happen before (on a different project) and it proved to be a minor disaster. I want the 3rd party files to be committed to my local branch.

The files that I committed before I pulled the 3rd party files held only minor changes and can be overwritten if they really need be.

I have read the docs, but this only confused me.

Upvotes: 1

Views: 1130

Answers (1)

planetmaker
planetmaker

Reputation: 6044

Generally: you'll not lose anything - the only thing which can go wrong is that your merge result is not what you want. Thus if you are unsure, first thing to do: make a (local) clone of your local repository - it's the easiest way to undo an unwanted or 'wrong' merge, if you have a repo where it never happend.

If I understand you right, you want to continue (later) on your own local head and merge the upstream commits into your own modifications. Then it's mostly a question on which way you do the merge. Thus usually for the above described scenario you need to checkout your head and then merge the head of the changesets which you pulled from upstream.

And the merge dialogue will then prompt you to manually solve those conflicts where automatic conflict resolution doesn't work. Maybe you want to configure a nicer merge tool, my personal preference is kdiff3 as it shows you the conflicting parts in both old forms and allows you to manually merge-edit it while having both references nicely on the screen during the merge. See KDiff3 for how to configure it. There are other merge tools which you might prefer more, most likely you can easily configure the one of your choice being used (ExtdiffExtension).

If you simply want to say that the 'other' changes are the ones you want to keep and to discard your own in case of conflict you can do like

hg merge --rev OTHER --tool other

Generally, even without a fancy merge tool, I'd just do a normal merge though and then visit in an editor the files with conflict and search for the conflict markers (<<<<<, ======, >>>>>) and use my wits to decide which code I want in those places as the merged code.

Upvotes: 1

Related Questions