用原始存储库中的内容强制覆盖本地文件? [英] Force overwrite of local file with what's in origin repo?
本文介绍了用原始存储库中的内容强制覆盖本地文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取存储库中的最新文件,并覆盖本地的文件.如何使用git客户端执行此操作?
I want to get the latest file that's in the repository, and overwrite what I have locally. How can I do this with the git client?
推荐答案
如果您只想覆盖一个文件:
If you want to overwrite only one file:
git fetch
git checkout origin/master <filepath>
如果要覆盖所有个更改的文件:
If you want to overwrite all changed files:
git fetch
git reset --hard origin/master
(这假设您正在本地处理master
,并且希望在原点的master
上进行更改-如果您在分支上,请用它代替.)
(This assumes that you're working on master
locally and you want the changes on the origin's master
- if you're on a branch, substitute that in instead.)
这篇关于用原始存储库中的内容强制覆盖本地文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文