On a git project, I ve been working from two different machines. I updated a same file on those 2 different machines. It raises conflicts on git pull
. So I try to do a git checkout
of the file that raises the conflicts but the checkout
of the file never succeed.
In detail:
I want to pull
on machine B the last update made on machine A, and push
-ed from machine A to git repository Branch master
. Last update situation has change on file src/custom-pipes/my-pipe/my-pipe.ts
, it happens that I have also made some changes on that same file on Machine B (the one I want to update with repo content).
Step 1: From machine B. If I do a git fetch
, (as advised here to solve the issue I get in my title) and git pull
, I get:
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
Step 2: If I launch a git status
on machine B, I get:
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)
Step 3: Then I launch git checkout -- "src/custom-pipes/my-pipe/my-pipe.ts"
, it says:
error: pathspec 'src/custom-pipes/my-pipe/my-pipe.ts' did not match any file(s) known to git.
Whatever get checkout -- [something]
I launched, I've tried with: .
, src/custom-pipes/my-pipe/my-pipe.ts
(as shown above), src/custom-pipes/.
,src/custom-pipes/my-pipe
,src/custom-pipes/.
. It works and says nothing, if the my-pipe
is not mentioned in what has to be checkout
. Or throw the error message like that:
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.
I any case, If I go back to Step 1 and I try to launch git fetch
and git pull
afterwards it does not pull
and throws:
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
Any advise?
UPDATE: I managed to make it work by removing without git the [repository and file] that were causing conflict. Then git pull
went smooth afterwards.