Skip to content

Instantly share code, notes, and snippets.

@da-n
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save da-n/9770842 to your computer and use it in GitHub Desktop.
Save da-n/9770842 to your computer and use it in GitHub Desktop.
Reset local repository to be just like remote repository

Setting your branch to exactly match the remote branch can be done in two steps:

git fetch origin
git reset --hard origin/master

If you want to save your current branch's state before doing this (just in case), you can do:

git commit -a -m "Saving my work, just in case"
git branch my-saved-work

Now your work is saved on the branch "my-saved-work" in case you decide you want it back (or want to look at it later or diff it against your updated branch).

-- Source http://stackoverflow.com/a/1628334/695454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment