Git - I ran into a merge conflict. How can I abort the merge

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I used git pull and had a merge conflict. I know that the other version of the file is good and that mine is bad so all my changes should be abandoned. How do I do this?

unmerged:   _widget.html.erb

You are in the middle of a conflicted merge.

Answers

Since your pull was unsuccessful then just HEAD is the last "valid" commit on your branch (not HEAD^):

git reset --hard HEAD

The other piece you want is to let their changes over-ride your changes.

Older versions of git allowed you to use the "theirs" merge strategy:

git pull --strategy=theirs remote_branch

http://marc.info/?l=git&m=121637513604413&w=2 http://marc.info/?l=git&m=121637513604413&w=2

git fetch origin
git reset --hard origin

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/101752/i-ran-into-a-merge-conflict-how-can-i-abort-the-merge

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils