Read the statement by Michael Teeuw here.
unable to git pull successfully
-
hi
trying to update my googlephotos and am facing the error.
error: Your local changes to the following files would be overwritten by merge:
package-lock.json
Please commit your changes or stash them before you merge.
error: The following untracked working tree files would be overwritten by merge:
.vscode/settings.json
types/google-photos.d.ts
types/type.d.ts
Please move or remove them before you merge.so i managed to git checkout package-lock.json.
but when i tried to git checkout .vscode/settings.json, i got the error error: pathspec ‘.vscode/settings.json’ did not match any file(s) known to git. same goes for the types/google-photos.d.ts and types/type.d.ts
what should i do next?
-
@1a2a3a If you want to reset the module without saving your local changes, you can do this in the module’s directory:
git fetch origin master git reset --hard origin/master git pull
-
@1a2a3a said in unable to git pull successfully:
error: Your local changes to the following files would be overwritten by merge:
package-lock.jsonthis file is regenerated by npm install, so just erase it
rm package-lock.json
but… these make no sense
error: The following untracked working tree files would be overwritten by merge: .vscode/settings.json types/google-photos.d.ts types/type.d.ts Please move or remove them before you merge.
as they are untracked, git doesn’t do anything with them…
but I see search results for that problem…
looks like you were developing in the module folder… so
you SHOULD be able to stash those files (hide them)
one suggestion (afer erasing the package-lock.json)git add * git stash git pull
after the pull,
git stash pop
-
@sdetweil did as per your mentioned but still stuck with .vscode/setting.json
-
@1a2a3a If you want to reset the module without saving your local changes, you can do this in the module’s directory:
git fetch origin master git reset --hard origin/master git pull
-
@KristjanESPERANTO thanks, that fixed it now!
-
@KristjanESPERANTO but why does this fix the problem of untracked files blocking pull? if they are untracked, they are not in the repo… I have never seen this happen
-
@sdetweil With
git reset ...
everything is reset hard, this fixes the problem, but does not help to explain it. I haven’t fully understood myself whygit pull
didn’t worked aftergit stash
.