Remove local changes from repository
So. Annoying.
Edited for brevity:
$ 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
Answers to similar questions state git rm --cached
will fix the problems, but am I doing it wrong? Because it says it didn't match any files? Maybe because I ran git reset?
那这个呢:
git clean -fd
You must have a look at this post i came up recently to know clearly on removing local changes
Various ways to remove local Git changes
"Conclusion:
It's clear that we can use either
(1) combination of git clean -f
and git reset --hard
OR
(2) git stash -u
to achieve the desired result.
git clean -f -d "
链接地址: http://www.djcxy.com/p/49256.html
上一篇: 不推送Sourcetree / Bitbucket
下一篇: 从存储库中删除本地更改