0

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.

1

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks. The pull worked perfectly. Why do I have to push back to origin if I've just pulled from it?
To send your local changes back. (assuming you had some)
Ah, I see. I hadn't made any yet, but that makes sense.
Just a note. Github has changed the default branch name from master to main in 2020.
Updated to reflect that

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.