Helen
Helen

Reputation: 265

How to resolve conflict for two unmerged commits in Git?

There are two commits which have conflicts. neither of them has been merged, then how to resolve the conflict and rebase the master branch?

I am only working on my own branch right now, and my commit have conflicts with another dev's commit. I cannot get her code from remote so I cannot use mergetool to resolve the conflict.

New to version control, thanks in advance!

Upvotes: 0

Views: 243

Answers (1)

Rushil
Rushil

Reputation: 135

From the git documentation:

You'll see conflict markers like these in the files where there's a conflict. Edit your file according to what it SHOULD be and delete the markers.

<<<<<<< HEAD:file.txt
Hello world
=======
Goodbye
>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt

Or you could use a merge tool. You'll get a great gui showing you the confilcting parts of each commit. You'll have to have a merge tool installed. If you do, After git prompts you of a merge conflict type:

git mergetool

If you don't have a mergetool installed, install one!

I use meld. Meld. You can install it using

apt-get meld

Other good options are Vimdiff kdiff and p4merge

Upvotes: 1

Related Questions