Local code repository can be synchronized with remote by following different ways :-

  • git fetch --prune

    -p, --prune
    After fetching, remove any remote-tracking branches which no longer exist on the remote.

  • git fetch origin
    git reset --hard origin/master
    git clean -f -d

    This makes your local repository exactly like your remote repository. Remember to replace origin and master with the remote and branch that you want to synchronize with.