Aero Wang Aero Wang - 2 years ago 114
Git Question

Is there a git --super/--force pull command?

I've done a lot of changes in my local repo, including deleting thousands of files, and making hundreds of changes. Meanwhile, I did a filesync (just didn't have access to the internet) to a different computer, and then continue to create thousands of files, deleting thousands of files, and making hundreds of changes. Now the repo works fine since I updated it from the computer I worked on later, yet when I want to pull to my previous computer, this becomes a nightmare...apparently I'd have to manually checkout all the files I deleted or changed and revert to my last HEAD before pulling there a simple super pull command to do just that? (just accept the remote repo as the super master)

I can just remove everything and do a git clone but since I have to then again install a lot of npm packages, it might take a while. Again, just by curiosity I'd like to know if there is a better way to do this then doing another git clone.

Answer Source

You can simply do:

git reset --hard <remote>/<branch>

to restore your local working folder to the version you had before doing any modifications, and then git pull should work fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download