Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I wipe out my local branch in GIT?

Tags:

git

I dont' want to deal with any conflicts on my local master branch as the origin (remote) master has changed and I just want 100% of the remote's version.

Is there a way to wipe out the local master? (other than just manually deleting and cloning again).

like image 925
mrblah Avatar asked Dec 02 '09 23:12

mrblah


2 Answers

When on branch 'master', you can simply do

git reset --hard origin/master

Note that you would lose your local changes that way.

like image 171
Jakub Narębski Avatar answered Sep 16 '22 21:09

Jakub Narębski


Here's how I would do it (while on master):

git fetch origin
git reset --hard origin/master

As evidenced by the other answers, there's more than one way to get this done. Somehow, to me this just seems the most straightforward.

EDIT: Where'd all the other answers go??

like image 39
Dan Moulding Avatar answered Sep 19 '22 21:09

Dan Moulding