简体   繁体   中英

how do I make erase everything off of local repo and merge in new repo?

I pulled off of the Master branch but forgot to build a new branch on my local repo before making changes. I don't mind losing the changes on my local repo, I just want to go back to the original Master as I got it. If I do a git pull, will that make me go through all the differences that I've made? How do I just ignore those differences if it does?

It's pretty easy, and best of all, you don't have to lose any of your changes:

$ git checkout master
$ git branch new-branch-name-for-changes
$ git reset --hard origin/master
$ git pull

Your changes will be saved on the new branch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM