git reset --hard origin / master是什么意思? [英] What is the meaning of git reset --hard origin/master?

查看:7543
本文介绍了git reset --hard origin / master是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个git pull并出现错误以下工作树文件将被合并覆盖...请在合并之前移动或移除它们。为了解决这个问题,我做了以下工作:

I did a git pull and got an error "The following working tree files would be overwritten by merge... Please move or remove them before you can merge". To resolve this I did the following

git fetch
git reset --hard origin/master

现在,当我执行git pull时,它说明所有内容都是最新的。我想知道当我运行这些命令时发生了什么。我知道 git fetch 从远程仓库获取更改,而无需将它们合并到本地仓库中。

Now when I do git pull, it says everything up to date.I want to know what exactly happens when i run these commands. I know git fetch fetches the changes from the remote repo without merging them into my local repo.

什么是含义 git reset --hard origin / master ?它是如何工作的?

What is the meaning of git reset --hard origin/master? How does it work?

推荐答案

git reset --hard origin/master

说:抛开我所有的暂存和未分离的更改,忘记当前本地分支上的所有内容,并使其完全相同作为 origin / master

says: throw away all my staged and unstaged changes, forget everything on my current local branch and make it exactly the same as origin/master.

在运行命令之前,您可能想问这个问题。通过使用与硬重置相同的词语暗示破坏性。

You probably wanted to ask this before you ran the command. The destructive nature is hinted at by using the same words as in "hard reset".

这篇关于git reset --hard origin / master是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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