我有一个从远程存储库 fork 的存储库。我做了一些更改,更新了远程存储库,现在我想从远程存储库中提取所有更改,而不关心本地存储库中的任何内容。以前我一直在删除我的本地存储库,然后进行简单的 fork 和克隆。必须有更好的方法来做到这一点。魔法指令是什么?
最佳答案
如果我理解正确,您想丢弃本地分支上的提交(如果您已提交)。如果是这种情况,那么您想要:
# fetch updated branch(es) from origin
git fetch origin
# reset, including your work tree, to origin's master branch
# make sure you have your master branch checked out first!
# and also that you don't mind throwing away local commits or
# uncommitted modifications
git reset --hard origin/master
关于git - 从远程存储库中提取所有更改的 git 命令是什么?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5627660/