LBerger
LBerger

Reputation: 623

Cannot switch branches

I'm not at all a git expert and my local git repo is in a bad way. I have got two branches master and Deriche. I work now on local branch Deriche branch and I want to switch master

$ git checkout master 
error: Your local changes to the following files would be overwritten by checkout:
        modules/ximgproc/src/deriche_filter.cpp Please, commit your changes or stash them before you can switch branches. Aborting

then

$ git stash 
Saved working directory and index state WIP on Deriche: 64025bc Add files via upload 
HEAD is now at 64025bc Add files via upload

then again

$ git checkout master
error: Your local changes to the following files would be overwritten by checkout:
        modules/ximgproc/src/deriche_filter.cpp
Please, commit your changes or stash them before you can switch branches.
Aborting

Then git diff results are :

$git diff
diff --git a/modules/ximgproc/src/deriche_filter.cpp b/modules/ximgproc/src/deriche_filter.cpp
index 0e45ffb..58d20ca 100644
--- a/modules/ximgproc/src/deriche_filter.cpp
+++ b/modules/ximgproc/src/deriche_filter.cpp
@@ -1,464 +1,464 @@
-<U+FEFF>#include "precomp.hpp"
-#include "opencv2/highgui.hpp"
......

I have tried this without any success.

Thanks you in advance for your help

Upvotes: 1

Views: 1912

Answers (1)

Joseph K. Strauss
Joseph K. Strauss

Reputation: 4913

Probably something to do with that <U+FEFF> character. (It is a textual representation of Unicode character Unicode Character 'ZERO WIDTH NO-BREAK SPACE'.)

That being said, if git stash and git reset --hard do not work, try

git checkout HEAD~0
git add modules/ximgproc/src/deriche_filter.cpp
git commit -m Trash

Upvotes: 2

Related Questions