Skip to content

Instantly share code, notes, and snippets.

@mmaia
Last active May 30, 2018 11:10
Show Gist options
  • Save mmaia/2e4248d757722d4ce3b71df1448f39a2 to your computer and use it in GitHub Desktop.
Save mmaia/2e4248d757722d4ce3b71df1448f39a2 to your computer and use it in GitHub Desktop.
Force local forked repo to be exactly like upstream

WARNING: This will override any local custom changes made to the repository and replace it's contents to be exactly like the upstream repo, use git remote -v to check the origin and upstream repos, the origin will be replaced to be identical with the upstream.

git fetch upstream
git checkout master
git reset --hard upstream/master  
git push origin master --force

Initially to set the upstream the following command was used:

git remote add upstream https://github.com/$some_user/$some_repo

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