user482594
user482594

Reputation: 17476

Using the remote branch instead of local branch in git

I want git to forget everything that I have edited in local branch, and want to pull the update from remote branch.

I did not know how to do that and I am getting merge conflicts on few files.

What should I do if I do not want to merge the files at all (local edits need to be deleted) and start new with the remote HEAD?

Upvotes: 2

Views: 344

Answers (2)

VonC
VonC

Reputation: 1323135

Supposing you are talking about changes done on master branch for instance:

git checkout master
git reset --hard origin/master
git pull

You reset master HEAD on the one of remote/master, and then can fetch remote/master + merge it to local master.

Upvotes: 6

OverZealous
OverZealous

Reputation: 39560

Why don't you just delete your local copy, and reclone the remote? That's effectively like deleting all your changes, without having to have local history for unwanted changes.

Upvotes: 0

Related Questions