. Advertisement .
..3..
. Advertisement .
..4..
I get an error
error: The following untracked working tree files would be overwritten by checkout:
source/a/foo.c
...... (too many lines)
Please move or remove them before you can switch branches.
Aborting
when trying to undefined. How to fix the please move or remove them before you switch branches error? Please give me some advice.
The cause: The document are untracked, and
git rm --cached
is unable to locate them because they are not in the index. That is the cause of the error “Please move or remove them before you switch branches”.Solution: Simply delete them using
rm
or your file manager. The checkout process should then go normally. It’s worth noting thatgit status
will show you how git perceives the files (tracked, changed, untracked; It will also indicate files that have been ignored if you select an extra option).git checkout -f master
-f
and--force
Source: https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html