I want to synchronize my local repository with a remote one so that my local repository becomes a 100% copy of the remote one - meaning that if certain files differ in these
Reset and sync local repository with remote branch
The command: Remember to replace origin and master with the remote and branch that you want to synchronize with.
git fetch origin && git reset --hard origin/master && git clean -f -d
Or step-by-step:
git fetch origin
git reset --hard origin/master
git clean -f -d
Your local branch is now an exact copy (commits and all) of the remote branch.
Command output:
Here is an example of running the command on a local clone of the Forge a git repository.
sharkbook:forge lbaxter$ git fetch origin && git reset --hard origin/master && git clean -f -d
HEAD is now at 356cd85 FORGE-680
Removing forge-example-plugin/
Removing plugin-container-api/
Removing plugin-container/
Removing shell/.forge_settings
sharkbook:forge lbaxter$