Git merge left HEAD marks in my files

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I tried to merge a file in the command line using Git, when an error message appeared telling me the merge was aborted.

I thought that was the end of it, but then I realized there are gitmarks in my files. Like so:

start =
    expression

validchar = 
    [0-9a-zA-Z_?!+-=@#$%^&*/.]

integer = 
<<<<<<< HEAD
    digits:[0-9]+
        { return digits.join(""); }
=======
    sign:"-"* digits:[0-9]+
        { return sign + digits.join(""); }
>>>>>>> gh-pages

The files have been edited not by me and show lines inserted with:

    • HEAD after less than signs (<<<<<<< HEAD)
    • lines of changed code
    • a string of equals signs (=======)
    • the new version of the code
    • another line starting with greater than signs and the name of the branch (>>>>>>> gh-pages)

What s worse is that the file contents are no longer in order. Does anyone know how I get those files back to normal, and the changes I made in the gh-branch merged into the master branch?

Answers

http://schacon.github.com/git/user-manual.html#resolving-a-merge http://schacon.github.com/git/user-manual.html#resolving-a-merge


For instance, in your particular case, you d probably want to resolve it like this (note - the arrows/text on the right are just my notes, not something you d type into the file):

integer = 
<<<<<<< HEAD                                  <-+ remove the bits here
    digits:[0-9]+                               |
        { return digits.join(""); }             |
=======                                       <-+
    sign:"-"* digits:[0-9]+
        { return sign + digits.join(""); }
>>>>>>> gh-pages                              <-- and this

and thus you d save the file as...

integer = 
    sign:"-"* digits:[0-9]+
        { return sign + digits.join(""); }

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/10657315/git-merge-left-head-marks-in-my-files

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils