After git reset --hard HEAD
, git pull
says: Untracked working tree file ... would be overwritten by merge
any ideas?
I did try a git fetch
and git fetch --all
already...
After git reset --hard HEAD
, git pull
says: Untracked working tree file ... would be overwritten by merge
any ideas?
I did try a git fetch
and git fetch --all
already...
you have untracked files. Simply
git stash -u
to stow them away in the stash and get a clean work tree (-u
specifies that you want to stash modifications along with new files). After you pull, merge, rebase or whatever, you can
git stash pop
to get them back.
You need to delete the untracked files. If you want to delete all untracked files, use git clean -fd
. Or if you don't want to delete them, use git stash -u
to keep it in stash state. To recover from stash state, use git stash pop
.
You still have untracked files (un git add
files). These are not removed by git reset.
If you want to keep them, you could do this:
git add -A
git stash
git pull
git stash apply
stash
is like a store where you can add files temporary without commiting them.
The reason this occurred in my repository was that another developer had removed a directory / from the main repository and moved it into a submodule. This particular repository had not been used for a long time, so the other develop moved the directory to a submodule between the time I last used the repo and today when the issue occured.
In this case its alright to just remove the offending untracked files.