因此。烦。
为简洁而编辑:
$ 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?
答案 0 :(得分:4)
这个怎么样:
git clean -fd
答案 1 :(得分:1)
你必须看看我最近提到的这篇文章,清楚地了解删除本地更改
Various ways to remove local Git changes
&#34;结论:
很明显我们可以使用
(1)git clean -f
和git reset --hard
的组合
OR
(2)git stash -u
达到理想的效果。
git clean -f -d "