admin管理员组文章数量:1334342
I'm trying to rebase a branch, and it hit a conflict where a file was replaced with a symlink in the main branch. It shows this in the output:
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add/rm <file>..." as appropriate to mark resolution)
deleted by us: path/to/file.yml~abcdefghi (BRANCHNAME branch-commit-msg)
However no matter how I try, I can't get this to change to a resolved state.
I tried all of the offered options:
$ git add path/to/file.yml
No output and also no change in the git status
output
$ git add path/to/file.yml~abcdefghi
fatal: pathspec 'path/to/file.yml~abcdefghi' did not match any files
$ git restore --staged path/to/file.yml
No output and also no change in the git status
output
$ git restore --staged path/to/file.yml~abcdefghi
fatal: pathspec 'path/to/file.yml~abcdefghi' did not match any files
$ git rm path/to/file.yml
rm 'path/to/file.yml'
The file is deleted but no change in the git status
output
$ git rm path/to/file.yml~abcdefghi
fatal: pathspec 'path/to/file.yml~abcdefghi' did not match any files
After each of these options I tried git rebase --continue
. For each option I get the same error:
path/to/file.yml~abcdefghi (BRANCHNAME branch-commit-msg): needs merge
You must edit all merge conflicts and then
mark them as resolved using git add
Can I resolve this without resorting to the nuclear option of taking a new branch from main
and copying all my changes?
I'm trying to rebase a branch, and it hit a conflict where a file was replaced with a symlink in the main branch. It shows this in the output:
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add/rm <file>..." as appropriate to mark resolution)
deleted by us: path/to/file.yml~abcdefghi (BRANCHNAME branch-commit-msg)
However no matter how I try, I can't get this to change to a resolved state.
I tried all of the offered options:
$ git add path/to/file.yml
No output and also no change in the git status
output
$ git add path/to/file.yml~abcdefghi
fatal: pathspec 'path/to/file.yml~abcdefghi' did not match any files
$ git restore --staged path/to/file.yml
No output and also no change in the git status
output
$ git restore --staged path/to/file.yml~abcdefghi
fatal: pathspec 'path/to/file.yml~abcdefghi' did not match any files
$ git rm path/to/file.yml
rm 'path/to/file.yml'
The file is deleted but no change in the git status
output
$ git rm path/to/file.yml~abcdefghi
fatal: pathspec 'path/to/file.yml~abcdefghi' did not match any files
After each of these options I tried git rebase --continue
. For each option I get the same error:
path/to/file.yml~abcdefghi (BRANCHNAME branch-commit-msg): needs merge
You must edit all merge conflicts and then
mark them as resolved using git add
Can I resolve this without resorting to the nuclear option of taking a new branch from main
and copying all my changes?
1 Answer
Reset to default -1After resetting and trying again I found that actually path/to/file.yml~abcdefghi (BRANCHNAME branch-commit-msg)
was the name of a file, including the spaces and parentheses. I thought it was some kind of annotation added by git to help identify the file but it's not. In the first attempt I also somehow managed to delete the file without noticing its odd name, and therefore I didn't see it in the ls -l
output.
So the tldr is don't get confused by strange file names...
本文标签: git quotdeleted by usquot conflict with no way to resolveStack Overflow
版权声明:本文标题:git "deleted by us" conflict with no way to resolve - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742355330a2459292.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
git add "path/to/file.yml~abcdefghi"
stackoverflow/questions/42174485/… – evolutionxbox Commented Nov 20, 2024 at 13:05file.yml~abcdefghi
is genuine, i.e., not an artefact of some mysterious operation (perhaps even one done by Git)? Did you check the directory? Is the file actually present? What doesgit ls-files -s path/to
tell you about the file? – j6t Commented Nov 20, 2024 at 13:27