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.
Pull
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 repository. More options can be configured in the 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, select Update existing and fetch new tags from More Options.
Push
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:
- Push Pushes all commits in one or more local branches to their matching remote branches. More precisely, on the Push dialog you can choose between pushing the commits in the current branch to its matching remote branch, and pushing the commits in all local branches with matching remote branches to said remote branches. A local branch `matches' a remote branch if the branch names match, e.g. `master' and `origin/master'. With this Push command you can push to multiple repositories in a single invocation. SmartGit will detect automatically whether a forced push will be necessary.
- Push To Pushes all commits in the current branch either to its matching branch, or to a ref specified by name. With the Push To command you can only push to one remote repository at a time. If multiple repositories have been set up, the Push To dialog will allow you to select the remote repository to push to. Also, the Push To command always allows to do a forced push, what can be convenient. This is necessary when pushing to a secondary remote repository for which forcing the push may be necessary while it is not when pushing to the primary remote repository (i.e. the one which is considered by SmartGit's forced push detection). You can also invoke Push To on a remote to push (or synchronize) all branches from the selected remote to another remote.
- Push Commits Pushes the selected range of commits from the Outgoing view, rather than all commits, in the current branch to its tracked remote branch.
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 main window:
- Menu and toolbar In the menu, you can invoke the various Pull commands with Remote|Push, Remote|Push To and Remote|Push Commits. The first two may also be available as toolbar buttons, depending on your toolbar configuration. The third command is only enabled if the Outgoing view is focused.
- Repositories view You can invoke Push in the Repositories view by selecting the open repository and choosing Push from the context menu.
- Branches view In the context menu of the Branches view, you can invoke Push and Push To on local branches. Additionally, you can invoke Push on tags.
- Outgoing view To push a range of commits up to a certain commit, select that commit in the Outgoing view and invoke Push Commits from the context menu.
Synchronize
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.
In SmartGit's main window, the Synchronize command can be invoked as follows:
- from the menu via Remote|Synchronize,
- with the Synchronize toolbar button,
- and in the Repositories view via Synchronize in the repository's context menu.
In the preferences you can configure the order of the push and pull commands.
Push, then Pull
If 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.
Pull, then Push
If there are both local and remote commits, the first triggered pull will fetch the remote changes, merge your local changes or rebase your local commits on top of the remote commits and if this was successful, invokes the push. This has the advantage that if there were no conflicts all your local changes are pushed. The disadvantage is that it may push untested changes.
Synchronizing with Remote Repositories的更多相关文章
-
git使用——远程仓库(Remote repositories)
前言 为了能在任意 Git 项目上协作,你需要知道如何管理自己的远程仓库. 远程仓库是指托管在因特网或其他网络中的你的项目的版本库. 你可以有好几个远程仓库,通常有些仓库对你只读,有些则可以读写. 与 ...
-
Git - Tutorial [Lars Vogel]
From: http://www.vogella.com/tutorials/Git/article.html Git - Tutorial Lars Vogel Version 5.6 Copyri ...
-
Git - Tutorial官方【转】
转自:http://www.vogella.com/tutorials/Git/article.html#git_rename_branch Lars Vogel Version 5.8 Copyri ...
-
SmartGit STUDY 2
The Index The Index is an intermediate cache for preparing a commit. With SmartGit, you can make hea ...
-
svn 同步备份的所有问题,亲测可用
svnsync 异地同步收获 (2010-07-06 10:06:19) 转载▼ 标签: 杂谈 分类: svn svnsync 异地同步收获: 来自:我用Subversion - http://www ...
-
解决maven下载jar慢的问题(如何更换Maven下载源)
修改 配置文件 maven 安装 路径 F:\apache-maven-3.3.9\conf 修改 settings.xml 在 <mirrors> <!-- mirror | Sp ...
-
配置oozie4.10+hadoop2.5.2
终于将这个神秘的寻象人 oozie 安装配置成功了,这个困扰我好几天, 当看到如下的画面, 我觉得值! 废话少说,看我如何编译和安装过程: (已经将hadoop2.5.2HA 的环境搭建起来了,hiv ...
-
写给Git初学者的7个建议
[原文] - http://blog.jobbole.com/50603/ 当我刚刚开始使用Git的版本控制时,我根本不确定我付出那么多时间是不是会得到回报.Branch.Stage.Stash,这些 ...
-
Maven日常 —— 你应该知道的一二三
以前在日常工作中,使用Maven只是机械的执行Maven clean.Maven install,对其中的原理与过程并无了解,近期阅读了<Maven实战>,对Maven有了更深入的理解. ...
随机推荐
-
ORACLE 常见错误
ora-00904 : 标识符无效:查询语句中的列或表在oracle 中不存在:
-
iOS应用之间跳转
本篇博文将涉及到以下知识点: app应用跳转的原理解析 如何实现两个app应用之间的跳转 如何实现两个app之间跳转到指定界面 二.应用跳转原理 相信从一个应用跳转到另一个应用大家并不陌生,最常见的莫 ...
-
Linux下手动获取当前调用栈
被问到如何手动获取当前的调用栈,之前碰到过一时没记起来,现在回头整理一下. 其原理是:使用backtrace()从栈中获取当前调用各层函数调用的返回地址,backtrace_symbols()将对应地 ...
-
DM6437 dsp系列之启动过程全析(2)—AIS文件解析
本文均属自己阅读源码的点滴总结,转账请注明出处谢谢. 欢迎和大家交流.qq:1037701636 email: gzzaigcn2009@163.com,gzzaigcn2012@gmail.com ...
-
jvm强制类型转换
public class Integer_Object { public static void main(String[] args){ Object obj = new ooo(); // Int ...
-
如何在 Swift 中优雅地处理 JSON
阅读目录 在Swift中使用JSON的问题 开始 基础用法 枚举(Enumeration) 下标(Subscripts) 打印 调试与错误处理 后记 因为Swift对于类型有非常严格的控制,它在处 ...
-
Python 100例(下)
如果你坚持到这了,哪就为自己鼓掌吧!坚持,你一定可以. 实例51: 题目:学习使用按位与&. #!/usr/bin/env python# --*--coding:utf-8 --*--'' ...
-
[转]RMI方式Ehcache集群的源码分析
RMI方式Ehcache集群的源码分析 Ehcache不仅支持基本的内存缓存,还支持多种方式将本地内存中的缓存同步到其他使用Ehcache的服务器中,形成集群.如下图所示: Ehcache支持 ...
-
jupyter nootbook本地使用指南
本地文件读入jupyter notebook 在文件夹内,shift+鼠标右键,出现菜单中选择“”在此处打开命令窗口“”,输入jupyter notebook, 可以把本地文件读入jupyter.
-
tomcat9 点击bin目录下的startup.bat一闪而过
我装的是tomcat9免安装版,jdk版本是11,之后去tomcat bin目录下点击startup.bat闪退(好吧,只有想办法解决了) 博客中的解决办法五花八门,什么环境变量没配好....不过都不 ...