解决冲突后无法藏匿

时间:2019-09-20 17:07:09

标签: git

这是发生的事情:我进行了一些更改,这显然造成了冲突。我通过删除相关文件中的冲突行来解决了冲突。我通常不处理冲突,因此我不确定从这里去哪里。现在我不能藏起来了,因为

file.ext: needs merge

我该怎么办?

编辑:git status的输出:

On branch some_branch
Your branch is up to date with 'origin/some_branch'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   xxx.xy
    modified:   xxx.xy
    modified:   xxx.xy
    modified:   xxx.xy
    modified:   xxx.xy
    modified:   xxx.xy
    modified:   xxx.xy

Unmerged paths:
  (use "git restore --staged <file>..." to unstage)
  (use "git add <file>..." to mark resolution)
    both modified:   file_with_conflict.xy

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    some_file
    some_file
    some_file
    some_file
    some_file
    some_file
    some_file
    some_file
    some_file
    some_file
    some_file
    some_file

1 个答案:

答案 0 :(得分:2)

在git中,合并只是一种提交。因此,要将冲突标记为已解决,您可以在解决冲突后将其添加到分阶段的更改中。

git add path/to/conflicted/file.cpp

以这种方式解决了所有冲突后,您只需提交即可完成合并。

git commit

或者,要取消合并,您可以中止合并以将本地文件恢复为冲突前的状态。

git merge --abort