强制覆盖本地文件,它是什么来源回购? [英] Force overwrite of local file with what's it origin repo?

查看:89
本文介绍了强制覆盖本地文件,它是什么来源回购?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取存储库中的最新文件,并覆盖我在本地的内容。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆