I have two branches locally, master and Berislav. The latter is currently active, and I have committed all the changes. When I try to checkout to master, I get the following message:
error: Your local changes to the following files would be overwritten
by checkout: [list of files changed in the active branch] Please,
commit your changes or stash them before you can switch branches.
Aborting
However, everything else I tried — commit, status, merge — tells me that there’s nothing to commit (working directory clean). What do I need to do to get to my master branch?
EDIT: When I try git stash, I’m getting:
error: feeding unmodified [file path] to diffcore
for all the files listed in the error above.
I encountered a similar problem today.
git statuswasn’t listing the files which checkout was complaining about. I did a:And that undoes any changes to the file.
An even easier way to undo all unstaged changes on current working directory [1]:
[1] – Be warned – you will lose any other unstaged changes you were working on (if any). If you don’t know what you are doing, then keep a backup of the files you were working on 🙂