“git checkout - [repository and file]”=>“error:pathspec'[repository and file]'与git已知的任何文件不匹配”
在git项目上,我一直从两个不同的机器。我在这两台不同的机器上更新了同一个文件。它引发了git pull
的冲突。所以我尝试做一个文件的git checkout
引发冲突,但文件的checkout
永远不会成功。“git checkout - [repository and file]”=>“error:pathspec'[repository and file]'与git已知的任何文件不匹配”
详细:
我想pull
机器B于机器A的最后一次更新,并push
计算机A向-ed Git仓库科master
。上次更新的情况在文件src/custom-pipes/my-pipe/my-pipe.ts
上有变化,恰巧我也对机器B上的同一个文件做了一些更改(我想用repo内容更新)。
第1步:从机B.如果我做一个git fetch
,(as advised here to solve the issue I get in my title)和git pull
,我得到:
error: The following untracked working tree files would be overwritten by merge:
src/custom-pipes/my-pipe/my-pipe.ts
Please move or remove them before you can merge.
Aborting
第2步:如果我在B机推出git status
,我得到:
On branch master
Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded. (use "git pull" to update your local branch)
Untracked files:
(use "git add ..." to include in what will be committed)
src/custom-pipes/my-pipe/
nothing added to commit but untracked files present (use "git add" to track)
第3步:然后我启动git checkout -- "src/custom-pipes/my-pipe/my-pipe.ts"
,它说:.
,src/custom-pipes/my-pipe/my-pipe.ts
(如上图所示),src/custom-pipes/.
,src/custom-pipes/my-pipe
,src/custom-pipes/.
:
error: pathspec 'src/custom-pipes/my-pipe/my-pipe.ts' did not match any file(s) known to git.
我发起无论get checkout -- [something]
,我已经试过了。它的作品并没有说什么,如果没有提到必须是checkout
。或者抛出这样的错误消息:
error: pathspec 'src/custom-pipes/my-pipe/my-pipe.ts' did not match any file(s) known to git. If
my-pipe
,my-pipe/.
ormy-pipe/my-pipe.ts
is involved in the path to checkout.
我任何情况下,如果我回去步骤1,我尝试推出git fetch
和git pull
之后它不pull
并抛出:
error: The following untracked working tree files would be overwritten by merge:
src/custom-pipes/my-pipe/my-pipe.ts
Please move or remove them before you can merge.
Aborting
有何建议?
更新:我设法让它通过,而不混帐的[库和文件]这是造成冲突的消除工作。然后git pull
之后顺利。
我设法通过删除没有git导致冲突的[存储库和文件]来使其工作。然后git pull
之后顺利。