Git合并在我的文件中留下了HEAD标记 [英] Git merge left HEAD marks in my files

查看:22
本文介绍了Git合并在我的文件中留下了HEAD标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 Git 在命令行中合并文件,但出现错误消息告诉我合并已中止.

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

我以为到此结束,但后来我意识到我的文件中有 gitmarks.像这样:

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 (<<<<<<<<<<)
  • 修改后的代码行
  • 一串等号(========)
  • 新版本的代码
  • 另一行以大于号和分支名称开头(>>>>>>>>> gh-pages)

更糟糕的是文件内容不再有序.有谁知道我如何让这些文件恢复正常,我在 gh-branch 中所做的更改合并到 master 分支中了吗?

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?

推荐答案

那些是冲突标记.您仍在合并过程中,但有些部分 Git 无法自动合并.您将需要手动编辑这些部分你希望他们成为什么样的人,然后提交结果.

Those are conflict markers. You're still in the process of merging, but there were some parts that Git couldn't merge automatically. You'll need to hand-edit those parts to what you want them to be and then commit the results.

例如,在您的特定情况下,您可能希望像这样解决它(注意 - 右侧的箭头/文本只是我的笔记,而不是您输入到文件中的内容):

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(""); }

这篇关于Git合并在我的文件中留下了HEAD标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆