Search code examples
gitgit-pull

How do I pull from my "public" git server to bring my broken local "master" up to date?


I have a local "master" git repository. Every few hours, I 'git push' my changes to a server from which I then pull to my client machines. Well, I accidentally used GITK to rollback my local "master" repository one version too far.

What are the steps to pull the last committed version back from the server and still have my local version behave "masterfully"?


Solution

  • Assuming your local master is still clean, i.e., no local changes, but some number of commits behind master on the server repo, you need only pull from it:

    git pull server master
    

    In the above command, server is the name of the remote that other clients pull from (or you could use its URL instead).