I encountered the same problem and solved it by
git checkout -f branch
Well, be careful with the -f
switch. You will lose any uncommitted changes if you use the -f
switch. While there may be some use cases where it is helpful to use -f
, in most cases, you may want to stash
your changes and then switch
branches. The stashing
procedure is explained above.