Whenever I try to checkout to a new branch I get the following message:
$ git co my branch
error: Your local changes to the following files would be overwritten by checkout:
.vscode/c_cpp_properties.json
.vscode/launch.json
Please commit your changes or stash them before you switch branches.
Aborting
If I run $ git status
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
I saw other posts about git the first error message, but nothing solved my problem, which I believe is more git update-index --skip-worktree
related.
The only option left was git checkout -f
which I didn't try because I would rather not force things.
I tried git git stash save .vscode/launch.json
$ git stash save .vscode/launch.json
No local changes to save
These files are among the ones I git update index --skip-wortree
ed:
$ git ls-files -t | grep "S "
S .vscode/c_cpp_properties.json
S .vscode/launch.json
S .vscode/settings.json
S CMakeSettings.json
S msvc_build.bat
I saw a few other posts about this error, but none seemed related to update-index --skip-worktree
The only option I haven't tried yet is checkout -f
which I am quite reluctant to use, because I don't like to force things whenever possible.