When i make some changes to a branch and try switching to the master branch I keep getting this error: The following untracked working tree files would be overwritten by checkout
The solutions on this thread dont work: The following untracked working tree files would be overwritten by checkout
My guess as to what is causing this error is that the files listed in your error are untracked in your current
searchPlus
branch, but they are tracked in yourmaster
branch. If Git were to checkoutmaster
blindly, it would clobber (i.e. overwrite) these files. When Git checks out another branch it overwrites every tracked file. Normally, if the file being overwritten is already being tracked, there is minimal risk because you still have the other branch somewhere. However, in the case of your untracked files, it would overwrite them, and you would therefore lose the state these files had onsearchPlus
. To make matters worse, after checking outmaster
, if you were to return tosearchPlus
, these files would actually disappear because Git would determine that these files do not exist in yoursearchPlus
branch.To get around this, one possible solution would be to just
git add
these files and make a commit. Assuming they were already committed inmaster
, perhaps it makes sense for these files to be versioned everywhere.As a side note, those
.project
files in your error message look suspicious to me. Typically, configuration files should not be versioned by Git, so you might want to see whether you really even want them versioned in themaster
branch.