https://git-scm.com/book/tr/v2/Git-Basics-Viewing-the-Commit-History

gil log 来查看commit的记录

Other maintainers prefer to rebase or cherry-pick contributed work on top of their master branch, rather than merging it in, to keep a mostly linear history. When you have work in a topic branch and have determined that you want to integrate it, you move to that branch and run the rebase command to rebuild the changes on top of your current master (or develop, and so on) branch. If that works well, you can fast-forward your master branch, and you’ll end up with a linear project history.

The other way to move introduced work from one branch to another is to cherry-pick it. A cherry-pick in Git is like a rebase for a single commit. It takes the patch that was introduced in a commit and tries to reapply it on the branch you’re currently on. This is useful if you have a number of commits on a topic branch and you want to integrate only one of them, or if you only have one commit on a topic branch and you’d prefer to cherry-pick it rather than run rebase. For example, suppose you have a project that looks like this:

Figure 80. Example history before a cherry-pick.

If you want to pull commit e43a6 into your master branch, you can run

$ git cherry-pick e43a6
Finished one cherry-pick.
[master]: created a0a41a9: "More friendly message when locking the index fails."
3 files changed, 17 insertions(+), 3 deletions(-)

This pulls the same change introduced in e43a6, but you get a new commit SHA-1 value, because the date applied is different. Now your history looks like this:

Figure 81. History after cherry-picking a commit on a topic branch.

Now you can remove your topic branch and drop the commits you didn’t want to pull in.

git 只merge一个commit的方法的更多相关文章

  1. [VC]在VC++中实现让程序只运行一个实例的方法且实现该实例

    方法一: 有时候在开发应用程序时,希望控制程序运行唯一的实例.例如,最常用的mp3播放软 件Winamp,由于它需要独占计算机中的音频设备,因此该程序只允许自身运行唯一的一个例程.在Visual C+ ...

  2. 关于WPF程序只运行一个实例的方法

    找到的方法有两种: 1)http://www.cnblogs.com/liuyazhou/archive/2009/11/02/1594364.html 2)http://codereview.sta ...

  3. 虚拟机中安装完Lunix系统后,开机黑屏,只显示一个-,解决方法

    1,查看设置->硬盘是不是SCSI,如果是,先关闭虚拟机,移除该硬盘(实际数据不会删除) 2,添加一个新的虚拟硬盘,最后位置选IDE设备 3,确定,重启虚拟机即可

  4. git只合并某一个分支的某个commit

    第一种情况:只合并一个commit git checkout develop-hbb git cherry-pick 7c32be61 以上,7c32be61是develop上的一个fix bug的c ...

  5. ExpandableListView(三)只展开一个group,没有child不展开group

    本文是自己在实践中,发现的问题. 有时候想让界面更加的人性化,就要实现很多的效果,比如只展开一个group,在点击下个group的同时,关闭之前的group 在一个ExpandableListView ...

  6. vc++高级班之窗口篇[4]---让程序只运行一个实例

      大家都看过或者使用过类似只运行一个实例的程序,比如:QQ游戏.部分浏览器 等等! 让一个程序只运行一个实例的方法有多种,但是原理都类似,也就是在程序创建后,有窗口的程序在窗口创建前, 检查系统中是 ...

  7. git 如何revert指定范围内的commit并且只生成一个新的commit?

    答:一共分成两步 一. revert多个commit并生成多个新的commit git revert <old commit>^..<new commit> 二. 使用reba ...

  8. Git如何修改一个过去的Commit

    假设我的git log 如下: commit 5511533dda6fee6982175fafca1f4bd5692e3d9c (HEAD -> trans, origin/trans) Aut ...

  9. Git出现error: Your local changes to the following files would be overwritten by merge: ... Please, commit your changes or stash them before you can merge.的问题解决(Git代码冲突)

    在使用git pull拉取服务器最新版本时,如果出现error: Your local changes to the following files would be overwritten by m ...

随机推荐

  1. Java int Integer

    http://www.cnblogs.com/haimingwey/archive/2012/04/16/2451813.html http://developer.51cto.com/art/200 ...

  2. C#枚举(enum)、常量(const)和readonly

    const修饰的是(类)静态常量,,其值是在编译期间确定的readonly修饰的是动态常量. A.C#中的const和readonly的区别 C#中定义常量有两种方式,一种叫做静态常量,使用“cons ...

  3. Linux配置Oracle 11g自动启动

    http://www.cnblogs.com/edwardcmh/archive/2012/05/11/2495671.html 安装完毕Oracle 11g每次都得手动启动 | 停止数据库(dbst ...

  4. [转] c# 操作Word

    来自 风过四季天 的原文 c# 操作Word总结 在医疗管理系统中为保存患者的体检和治疗记录,方便以后的医生或其他人查看.当把数据保存到数据库中,需要新建很多的字段,而且操作很繁琐,于是想 到网页的信 ...

  5. K2 Blackpearl中从数据库直接删除流程实例之K2ServerLog表

    转:http://www.cnblogs.com/dannyli/archive/2012/11/29/2794845.html /********************************** ...

  6. yarn学习

  7. Spring cloud Eureka高可用 - Windows 7 hosts文件立即生效

    hosts 文件所在位置 c:/windows/system32/drivers/etc/hosts 左下角 搜索框 搜索 cmd 弹出命令框 输入 ipconfig /displaydns 显示所有 ...

  8. HTTP 状态信息

    一.1xx 消息 该类型的状态码代表请求已被接受,需要继续处理. 100 Continue 客户端应当继续发送请求,这个临时响应是用来通知客户端的部分请求已经被服务器接收,且仍未被拒绝.客户端应当继续 ...

  9. jquery排序与动态添加option以及属性

    function getOrgansid() { url="<%=basePath%>/rest/bsc/organ/selectOrganSidAllList"; $ ...

  10. selenium安装方式

    selenium的二种安装方式 1.在线安装:打开cmd输入, pip.ext install selenium 2.离线安装,下载selenium安装包,然后解压,在cmd中进入到解压的文件中,在运 ...