git : give me the repo, 核对本地的一切,我不在乎

标签 git

git 是否有任何 pull/checkout ‘nuclear option’ 来获取 repo? 我不关心任何冲突,我不需要任何本地的东西, 只是想要 cargo ,所以我可以工作。

[编辑] 澄清我的问题:

$ git pull
error: Your local changes to the following files would be overwritten by merge:

<...files I couldn't care less about...>

Please, commit your changes or stash them before you can merge.
error: The following untracked working tree files would be overwritten by merge:

<...more files I couldn't care less about...>

最佳答案

最好了解各种 git 命令,然后“立即”找到您需要的命令,因为您会多次遇到这种情况,并且在提示和 blame git 的同时零碎地学习。

编辑:我继续尝试所有选项,这应该可以。感谢 pauljz 的评论。

git clean -df # remove untracked files AND directories
git reset HEAD --hard # revert any uncommitted changes

以上应该是您所需要的。

其他选项:

git pull -f # replace local files even if you have unpushed commits.

git reset HEAD --hard # remove unchanged, uncommitted files
git pull

git clean -f # remove untracked files (uncommitted files)
git pull

关于git : give me the repo, 核对本地的一切,我不在乎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16548486/

相关文章:

git - "Will not add file alias ' samefile ' (' SameFile ' already exists in index)"`git add`操作时

gitlab通过命令行获取特定分支的tar

Git 警告 : refname 'xxx' is ambiguous

git - 如何在 git 中执行 "hg mv --after"?

git - 如何在 Android Studio 中 git commit diff 期间编辑文件?

git - 如何撤消 GIT 中意外提交的 'Unversioned' 文件

git - "at"@ sign/symbol/character 在 Git 中是什么意思?

node.js - 如果 webpack 构建失败则中止 post-receive Hook

java - git pull 后无法解决冲突

git - 如何确定远程 git 存储库的 URL?