In a local folder with several files, I have a git repository for which branch x only includes a few of those files, and the master one inc
The problem is that you have files that have not been added to the working tree (Eg: new files created after the last commit). Git is preventing you from losing those files when you want to switch branches.
In order to be able to change the branch, you can either add those files to the working tree (git add file1.out
or for all: git add --all
) or you can remove them (git rm file1.out ...
). Then you can either commit or (if not ready) you can stash them (git stash
) and when you want them back (git stash pop
)
More info here and here.