开发者

Using the remote branch instead of local branch in git

开发者 https://www.devze.com 2023-03-28 12:13 出处:网络
I want git to forget everything that I have edited in local branch, and want to pull the update from remote branch.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消