标签:问题 获取 blog text merge epo solution ted 微软
我在使用最新版的VS2017时,想获取服务器上最新代码,Fetch到了最新修改,但是在拉取代码的时候出现了问题
user@user-PC MINGW64 /d/demo/myrepos (dev-css)
$ git pull origin dev-css
From https://winleechina.visualstudio.com/_git/PartTimeJob
* branch dev-css -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
BaseSite/Code/.vs/BaseSite/v15/Server/sqlite3/storage.ide-shm
BaseSite/Code/.vs/BaseSite/v15/Server/sqlite3/storage.ide-wal
BaseSite/Code/.vs/BaseSite/v15/sqlite3/storage.ide-shm
BaseSite/Code/.vs/BaseSite/v15/sqlite3/storage.ide-wal
Please commit your changes or stash them before you merge.
Aborting
Updating d568290..cf89950
user@user-PC MINGW64 /d/demo/myrepos (dev-css)
$ git status
On branch dev-css
Your branch is behind ‘origin/dev-css‘ by 8 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: BaseSite/Code/.vs/BaseSite/v15/Server/sqlite3/storage.ide-shm
modified: BaseSite/Code/.vs/BaseSite/v15/sqlite3/storage.ide-shm
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitattributes
.gitignore
no changes added to commit (use "git add" and/or "git commit -a")
于是我采用常规套路(签入,或者撤销checkout) 都是失败,而且不能undo change其中两个文件storage.ide-shm/storage.ide-shm;
这个问题的最终结果就是导致我不能拉取最新代码。
好在在StackOverflow发现如下方法
text git rm [path_and_filename] --cached //该命令将永远不想签入的文件从索引(index)中移除,如果不想这个文件存在磁盘上,可以使用git rm [path_and_filename] --force
将操作后的文件(此时已经是staged)提交就好了
Ps:
.gitignore 是最先想到的方法,但是也不行,不过SO上有人貌似是可以的,如下:
# Visual Studio 2015 cache/options directory
.vs/
微软官档:
Run the following:
git rm --cached
Commit the removal of the file and the updated .gitignore to your repo.
参考地址:
标签:问题 获取 blog text merge epo solution ted 微软
原文地址:http://www.cnblogs.com/winleechina/p/7865175.html