简体   繁体   中英

Github repo out of sync with local

I have a master project stored on my development machine. I push this to Github when changes are made.

But, I made 2 changes directly on Github as they were only modifications to the README and I was on a different computer.

My local is now different to the remote (the Github repo).

How do I get the local back in sync? The local was the main copy, but I think it's better to have the Github repo as the master.

You should run a git pull origin main and merge with your local.

When done merging do git push origin main to sync up the remote

If your local changes are too large you can use git stash to hide them temporarily and pop them out of the stash ( git stash pop ).


EDIT: October 2020: Github changed master to main . For older git repos please use master instead of main in above commands

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