Synchronizing the states of local and remote repositories consists of pulling from and pushing to the remote repositories. SmartGit also has a Synchronize command that combines pulling and pushing.
The Pull command fetches commits from a remote repository, stores them in the remote branches, and optionally 'integrates' (i.e. merges or rebases) them into the local branch.
Use Remote|Pull (or the corresponding toolbar button) to invoke the Pull command. This will open the Pull dialog, where you can specify what SmartGit will do after the commits have been fetched: Merge the local commits with the fetched commits or rebase the local commits onto the fetched commits. In the latter case, you can merge or rebase by hand, as explained in Merge and Rebase, respectively. These options are meaningless, if you select to Fetch Only.
The Pull dialog allows you to set your choice as default for the current branch. To change the default choice for new branches, go to Repository|Settings.
If a merge or rebase is performed after pulling, it may fail due to conflicting changes. In that case SmartGit will leave the repository in a merging or rebasing state so you can either resolve the conflicts and proceed, or abort the operation. See Merge and Rebase for details.
By default, Git (and hence SmartGit) will only pull new tags, but don't update
possibly changed tags from the remote repository.
To have tags updated as well, you have to configure
for your remote.
To update tags when pulling from
The various Push commands allow you to push (i.e. send) your local commits to one or more remote repositories. SmartGit distinguishes between the following Push commands:
If you try to push commits from a new local branch, you will be asked whether to set up tracking for the newly created remote branch. In most cases it is recommended to set up tracking, as it will allow you to receive changes from the remote repository and make use of Git's branch synchronization mechanism (see Branches).
The Push commands listed above can be invoked from several places in SmartGit's project window:
With the Synchronize command, you can push local commits to a remote repository and pull commits from that repository at the same time. This simplifies the common workflow of separately invoking Push and Pull to keep your repository synchronized with the remote repository.
If the Synchronize command is invoked and there are both local and remote commits, the invoked push operation fails. The pull operation on the other hand is performed even in case of failure, so that the commits from the remote repository are available in the tracked branch, ready to be merged or rebased. After the remote changes have been applied to the local branch, you may invoke the Synchronize command again.
In SmartGit's project window, the Synchronize command can be invoked as follows:
Why does SmartGit first Push, then Pull?
SmartGit first tries to Push, then Pulls. If the Push failed because of remote changes, you will have the remote changes already locally available and can test the local changes before pushing them by invoking Push or Synchronize a second time.
If SmartGit would first Pull and then Push, local changes either would be rebased on top of the pulled remote changes or remote changes silently merged to local changes. This would mean to push untested changes.