git-sync is used for syncing a personal fork with the upstream repository the personal fork was created from. Syncing here means updating all the branches in the personal fork that are also present in the upstream repository.
git-sync will by default only update the branches in the remote repository for your personal fork (i.e. your local repository on disk will remain unchanged).
git-sync can sync both the personal fork and a local repository of the personal fork, see the Examples section that involves the flags
git-sync uses multiple strategies to figure out the repository to sync from (i.e. the repository the personal fork was created from):
- If the --from option is defined via either configuration or command-line
- If a remote named upstream is present for the repository
- If it can connect via REST HTTP APIs for the current forge
The repository to sync to will by default be the repository that the remote named "origin" refers to.
Sync a personal fork and explicitly set both the from and to repository:
Add a remote named "upstream" and rely on git-sync to by default pick up the remote named "origin" for the to option:
Sync a personal fork (relying on "upstream" and "origin" remotes being present) and also pull the latest changes for current active branch from your personal fork:
Sync a personal fork (relying on "upstream" and "origin" remotes being present) and also fast-forward all branches in the local repository:
All options to
git-sync can be configured via
git-config. For example, to make
git-sync always fast-forward all branches in the local repository when syncing, set