Files
30-seconds-of-code/snippets/git/s/reset-master.md
2023-05-07 16:07:29 +03:00

693 B

title, type, language, tags, cover, dateModified
title type language tags cover dateModified
Reset master to match remote snippet git
repository
branch
old-consoles 2021-04-13T21:10:59+03:00

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`