Skip to content

Instantly share code, notes, and snippets.

@michaelvdnest
Last active January 13, 2020 12:55
Show Gist options
  • Save michaelvdnest/6f20a2ff1f88dbf378f993ba368193c2 to your computer and use it in GitHub Desktop.
Save michaelvdnest/6f20a2ff1f88dbf378f993ba368193c2 to your computer and use it in GitHub Desktop.
Common git commands

Reset to remote master

# Add a remote brannch
git remote add upstream /url/to/original/repo

# fetch the upstream repo
git fetch upstream

# ensures current branch is master
git checkout master

# pulls all new commits made to upstream/master
git pull upstream master

# this will delete all your local changes to master
git reset --hard upstream/master

# take care, this will delete all your changes on your forked master
git push origin master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment