What is the meaning of git reset –hard origin/master?

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

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.

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

2 Answers
2

Leave a Comment