Files
30-seconds-of-code/snippets/reset-master.md
Isabelle Viktoria Maciohsek aed3d78bb1 Add reset master
2021-04-06 16:58:58 +03:00

610 B

title, tags
title tags
Reset master to match remote repository,branch,intermediate

Resets the local master branch to match the one on the remote.

  • Use git fetch origin to retrieve the latest updates from the remote.
  • Use git checkout master to switch to the master branch.
  • Use git reset --hard origin/master to reset the local master branch to match the one on the remote.
git fetch origin
git checkout master
git reset --hard origin/master
git fetch origin
git checkout master
git reset --hard origin/master
# Local `master` branch is now up to date with remote `master`