从存储库中删除本地更改
所以。 烦人。
为简洁起见编辑:
$ git pull origin master
* branch master -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
app/models/page.rb
Please move or remove them before you can merge.
Aborting
$ git reset --hard
HEAD is now at d90309f
$ git pull origin master
* branch master -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
app/models/page.rb
Please move or remove them before you can merge.
Aborting
$ git rm --cached
usage: git rm [options] [--] <file>...
-n, --dry-run dry run
-q, --quiet do not list removed files
--cached only remove from the index
-f, --force override the up-to-date check
-r allow recursive removal
--ignore-unmatch exit with a zero status even if nothing matched
$ git pull origin master
From https://github.com/Jinxy5/laughing-octo-lana
* branch master -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
app/models/page.rb
Please move or remove them before you can merge.
Aborting
$ git rm --cached app/models/page.rb
fatal: pathspec 'app/models/page.rb' did not match any files
解决类似问题的答案git rm --cached
会解决这些问题,但我做错了吗? 因为它说它不匹配任何文件? 也许是因为我运行git reset?
那这个呢:
git clean -fd
你必须看看我最近想到的这篇文章,以清楚地了解如何移除本地更改
删除本地Git更改的各种方法
“结论:
很明显,我们可以使用
(1) git clean -f
和git reset --hard
OR
(2) git stash -u
来达到预期的效果。
git clean -f -d "
链接地址: http://www.djcxy.com/p/49255.html