【发布时间】:2018-11-26 21:37:49
【问题描述】:
我在 Mac OS X 上使用 git。如何恢复对文件的更改?更改尚未提交。我试过了
localhost:myproject davea$ git checkout -- .gitignore
error: pathspec '.gitignore' did not match any file(s) known to git.
上述错误没有意义,因为当我尝试从远程存储库中提取时,它抱怨我有无法覆盖的文件...
localhost:myproject davea$ git pull origin master
Username for 'https://github.com': myuser
Password for 'https://myuser@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/JBSinc/myproject.git/'
localhost:myproject davea$ git pull origin master
Username for 'https://github.com': myuser
Password for 'https://myuser@github.com':
From https://github.com/JBSinc/myproject
* branch master -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
.gitignore
Please move or remove them before you can merge.
Aborting
【问题讨论】:
-
由于文件没有被追踪,考虑用
rm或git clean删除。
标签: git revert vcs-checkout