The Rebase command allows you to apply commits from one branch to another. Rebase can be viewed as more powerful version of Cherry-Pick, which is optimized to apply multiple commits from one branch to another. In SmartGit, a distinction is made between Rebase HEAD to and Rebase to HEAD:

Rebase HEAD to rebases ("moves") the commits below the HEAD to the selected commit. The HEAD will be moved to the new fork.

o  [> master] A               o  [> master] A'
|                             |
o   B                         o  B'
|                             |
o   C                         o  C'
|                             |
|   o  [a-branch] D           |   o  [a-branch] D
|   |                         |  /
|   |                         | /
|   o  E (selected)   ===>    o   E
|  /                          |
| /                           |
o   F                         o   F

Rebase to HEAD duplicates commits from a separate branch to the HEAD (similar to what Cherry-Pick does). The HEAD moves forward on its fork.

                             o  [> master] B'
                             |
                             o  C'
                             |
                             o  D'
                             |
o  [> master] A              o  A
|                            |
|   o  [a-branch]            |   o  [a-branch]
|   |                        |   |
|   o  B (selected)          |   o  B
|   |                        |   |
|   o  C               ==>   |   o  C
|   |                        |   |
|   o  D                     |   o  D
|  /                         |  /
| /                          | /
o   E                        o   E

To Rebase Onto you may use the Log window. Consider following example where the quickfix2 branch should not start at the quickfix1 branch, but rather on the master branch:

q2b (quickfix2)
 |
q2a
 |
q1b (quickfix1)
 |
q1a
 |
 x (master)
 |
...

To achieve this, just drag the q2a commit onto the x (master) commit and you will get the desired result:

q2b (quickfix2)
 |
q2a
 |
 |  q1b (quickfix1)
 |   |
 |  q1b
 | /
 x (master)
 |
...

In SmartGit, there are several places from which you can initiate a rebase:

  • Menu and toolbar On the main window, select Branch|Rebase HEAD to or Branch|Rebase to HEAD to open the Rebase dialog, where you can select the branch to rebase the HEAD onto, or the branch to rebase onto the HEAD, respectively. Depending on your toolbar settings, you can also open this dialog via the buttons Rebase HEAD to and Rebase to HEAD on the toolbar.
  • Branches view In the Branches view, you can right-click on a branch and select Rebase HEAD to to rebase your current HEAD onto the selected branch.
  • Log Graph On the Log graph of the Log window, you can perform a rebase by right-clicking on a commit and selecting Rebase HEAD to or Rebase to HEAD from the context-menu.
  • Log Graph In the Log graph of the Log window, you can drag and drop commits or refs and then select to rebase in the occurring dialog after the drop.

Just like a merge, a rebase may fail due to merge conflicts. If that happens, SmartGit will leave the working tree in rebasing state, allowing you to either manually resolve the conflicts or to Abort the rebase. See Resolving Conflicts for further information.

Resolving Conflicts

Core Git rebase conflicts are different to other kinds of merge conflicts, because left and right files are swapped: when rebasing branch A to B, Git will first checkout B, then applies all commits from A. If a conflict occurs, HEAD still points to B and hence the left file would be the file as it's present in B.

From a user's perspective, the left file should always be his/her own file ("ours"), i.e. the file as it's present in A. For this reason, in case of rebase conflicts, SmartGit will swap left and right files. This gives a more consistent user experience, however may result in following different behavior (compared to normal merge conflicts):

  • When staging left lines (Ours) in the Conflict Solver, these lines will finally show up as staged, because your rebase branch B is actually "theirs"
  • When invoking Resolve and selecting Ours, you will see staged file content, because your rebase branch B is actually "theirs"

smartgit document Rebase的更多相关文章

  1. smartgit document merge

    'Normal' Merge In case of a normal merge, a merge commit with at least two parent commits (i.e., the ...

  2. SmartGit STUDY 2

    The Index The Index is an intermediate cache for preparing a commit. With SmartGit, you can make hea ...

  3. SmartGit as SVN Bridge

    This page provides an introduction to SmartGit from an SVN users perspective and shows how the SVN w ...

  4. SmartGit STUDY

    Git Concepts This section helps you to get started with Git and gives you an understanding of the fu ...

  5. document.documentElement.clientHeight 与 document.body.clientHeight(杜绝千篇一律的抄袭!!)

    document.documentElement.clientHeight 与 document.body.clientHeight用来获取页面可视高度我觉得有点问题.这两个应该不是一个东西. 页面中 ...

  6. jquery中的$(document).ready(function() {});

    当文档载入时执行function函数里的代码, 这部分代码主要声明,页面加载后 "监听事件" 的方法.例如: $(document).ready( $("a") ...

  7. document.compatMode

    在我电脑屏幕上显示的 电脑是 1920*1080这是在document.compatMode:css1Compat模式 window.screen.availWidth 1920 window.scr ...

  8. 谈谈document.ready和window.onload的区别

    在Jquery里面,我们可以看到两种写法:$(function(){}) 和$(document).ready(function(){}) 这两个方法的效果都是一样的,都是在dom文档树加载完之后执行 ...

  9. Git 进阶指南(git ssh keys / reset / rebase / alias / tag / submodule )

    在掌握了基础的 Git 使用 之后,可能会遇到一些常见的问题.以下是猫哥筛选总结的部分常见问题,分享给各位朋友,掌握了这些问题的中的要点之后,git 进阶也就完成了,它包含以下部分: 如何修改 ori ...

随机推荐

  1. HTTP详解(3)-http1.0 和http1.1 区别

    HTTP详解(3)-http1.0 和http1.1 区别 分类: 网络知识2013-03-17 16:51 1685人阅读 评论(0) 收藏 举报   目录(?)[+]   翻了下HTTP1.1的协 ...

  2. bootstrap部分---网格系统;(几天没写博客了,为了潜心研究一下bootstrap)

    1工作原理: (1)行必须放置在 .container class 内,以便获得适当的对齐(alignment)和内边距(padding). (2)使用行来创建列的水平组. (3)内容应该放置在列内, ...

  3. docker容器互联

    link方式 http://blog.csdn.net/halcyonbaby/article/details/42112325 通过link方式创建容器,然后我们可以使用被link容器的别名进行访问 ...

  4. leetcode 118 Pascal's Triangle ----- java

    Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Retur ...

  5. DELPHI相应鼠标滚轮

    在鼠标的MouseWheel事件里写入以下内容 if WheelDelta < 0 then    SendMessage(scrollBox1.Handle, WM_VSCROLL, SB_L ...

  6. Python爬虫学习笔记——豆瓣登陆(三)

    之前是不会想到登陆一个豆瓣会需要写三次博客,修改三次代码的. 本来昨天上午之前的代码用的挺好的,下午时候,我重新注册了一个号,怕豆瓣大号被封,想用小号爬,然后就开始出问题了,发现无法模拟登陆豆瓣了,开 ...

  7. Linux下tmpfs介绍及使用

    tmpfs介绍 tmpfs是一种虚拟内存文件系统,而不是块设备.是基于内存的文件系统,创建时不需要使用mkfs等初始化它最大的特点就是它的存储空间在VM(virtual memory),VM是由lin ...

  8. vs2010 无法创建 *.edmx(Entity Frame Work) 文件的问题

    当你安装了VS2010或者已经安装了EntityFramework41RC.exe之后发现依然在Add New Item时无法找到ADO.NET Entity Model,有可能是你创建的不是netf ...

  9. oracle数据字典-权限-角色

    每个数据库都提供了各自的数据字典的方案,虽然形式不同,但是目的和作用是一样的,比如在mysql里数据字典是在information_schema 里表现的,sqlserver则是在sys这个系统sch ...

  10. 剑指offer(07)-调整数组顺序使奇数位于偶数前面【转】

    来源:http://www.acmerblog.com/offer-6-2429/ 题目来自剑指offer系列 九度 1516 题目描述: 输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得 ...