A Git branch can be reset to exactly match the remote branch with the following commands:
Save the state of your current branch in another branch, named
my-backup,in case something goes wrong:
git commit -a -m "Backup." git branch my-backup
Fetch the remote branch and set your branch to match it:
git fetch origin git reset --hard origin/master
This example assumes that the remote repo’s name is “origin” and that the branch named “master”, in the remote repo, matches the currently checked-out branch in your local repo.
View all Courses