Reset your branch (Git)

Sometimes I get my branch in a state where I need to reset things to what is on the server. Most of the time a simple switch of branches is enough to get everything back in shape, but once in a while I need to actually reset to what is in the parent repo.

To reset your local working copy to exactly what is in the remote (typically called origin) do the following:

git fetch
git reset --hard origin/branch
git clean -x -d -f

These should be done in the root of your project.


Posted

in

, ,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: