在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
之後順利。