2

I have checkout branch and have made some changes. I want to overwrite the changes with the changes from same remote branch. I don't want to save the local changes made.

I tried git pull : It says "Already up to date" . But my local changes are still there.

user2480755
  • 97
  • 3
  • 11
  • 1
    Possible duplicate with https://stackoverflow.com/questions/1125968/how-do-i-force-git-pull-to-overwrite-local-files – junkangli Jun 01 '18 at 10:49
  • 1
    Possible duplicate of [How do I force "git pull" to overwrite local files?](https://stackoverflow.com/questions/1125968/how-do-i-force-git-pull-to-overwrite-local-files) – Aimery Jun 01 '18 at 10:54

2 Answers2

0

You have to reset the HEAD of the git repository to the one of your remote branch.

git reset --hard @{u}

@{u} points to the last commit on the remote branch. --hard discard all changes made.

Huntro
  • 322
  • 1
  • 3
  • 16
0

You have to reset hard using following command it will discard your changes and update with latest changes:

git fetch
git reset --hard origin/<branch_name>
dr. strange
  • 665
  • 7
  • 22