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 t开发者_C百科hat 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?
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
.
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.
精彩评论