Parth Mody
Parth Mody

Reputation: 466

copying remote master to local branch -git

Hey I am working on a local branch on an Android Project.I want to replace all code on my local branch with all the code on the remote master.When I try to do git pull origin master,it tries to merge and pulls up conflicts to resolve,which is undesirable since I just want to simply replace everything.

Upvotes: 0

Views: 63

Answers (1)

Schleis
Schleis

Reputation: 43700

You want to reset to the last commit on your local branch that is on the remote with

git reset --hard <sha of commit

Then you can do git pull origin master and it only bring the changes from the remote.

If you are not sure what the commit is you can use

git merge-base origin/master master

That will give the SHA of the last common commit. You can reset to that.

The other option is to delete the branch and re-checkout from the remote.

Upvotes: 1

Related Questions