How to replace local branch with remote branch entirely in Git?

  1. Make sure you’ve checked out the branch you’re replacing (from Zolt├ín’s comment).
  2. Assuming that master is the local branch you’re replacing, and that “origin/master” is the remote branch you want to reset to:

    git reset --hard origin/master

This updates your local HEAD branch to be the same revision as origin/master, and --hard will sync this change into the index and workspace as well.

Leave a Comment