0

I want to undo all my local changes and update my local machine with the code from git repository.

I have tried resetting the local branch by running the following commands:

git checkout 
git reset

When I run git checkout on local machine, it says:

Your branch and 'origin/my-dev-environment' have diverged, and have 1 and 26 different commits each, respectively. (use "git pull" to merge the remote branch into yours)

If I try git pull, it would complain about conflicts:

CONFLICT (content): Merge conflict in template/myfile.cs Auto-merging pages/somefile.html

How can I clear all changes from my local repository and just get a copy of upsteam repository?

Hooman Bahreini
  • 14,480
  • 11
  • 70
  • 137

1 Answers1

2

This is explained here: Reset local repository branch to be just like remote repository HEAD

git fetch origin
git reset --hard origin/master
CC.
  • 464
  • 4
  • 11