无法切换分支

时间:2016-05-11 13:51:49

标签: git github

我不是一个git专家,我当地的git repo是一个糟糕的方式。 我有两个分支大师和Deriche。我现在在当地分公司Deriche分公司工作,我想转换主人

$ 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

然后

$ 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
然后再次

$ 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

然后git diff结果是:

$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"
......

我试过this但没有成功。

提前感谢您的帮助

1 个答案:

答案 0 :(得分:2)

可能与<U+FEFF>字符有关。 (它是Unicode字符Unicode Character 'ZERO WIDTH NO-BREAK SPACE'的文本表示。)

话虽如此,如果git stashgit reset --hard不起作用,请尝试

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