git 只merge一个commit的方法
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:

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:

Now you can remove your topic branch and drop the commits you didn’t want to pull in.
git 只merge一个commit的方法的更多相关文章
- [VC]在VC++中实现让程序只运行一个实例的方法且实现该实例
方法一: 有时候在开发应用程序时,希望控制程序运行唯一的实例.例如,最常用的mp3播放软 件Winamp,由于它需要独占计算机中的音频设备,因此该程序只允许自身运行唯一的一个例程.在Visual C+ ...
- 关于WPF程序只运行一个实例的方法
找到的方法有两种: 1)http://www.cnblogs.com/liuyazhou/archive/2009/11/02/1594364.html 2)http://codereview.sta ...
- 虚拟机中安装完Lunix系统后,开机黑屏,只显示一个-,解决方法
1,查看设置->硬盘是不是SCSI,如果是,先关闭虚拟机,移除该硬盘(实际数据不会删除) 2,添加一个新的虚拟硬盘,最后位置选IDE设备 3,确定,重启虚拟机即可
- git只合并某一个分支的某个commit
第一种情况:只合并一个commit git checkout develop-hbb git cherry-pick 7c32be61 以上,7c32be61是develop上的一个fix bug的c ...
- ExpandableListView(三)只展开一个group,没有child不展开group
本文是自己在实践中,发现的问题. 有时候想让界面更加的人性化,就要实现很多的效果,比如只展开一个group,在点击下个group的同时,关闭之前的group 在一个ExpandableListView ...
- vc++高级班之窗口篇[4]---让程序只运行一个实例
大家都看过或者使用过类似只运行一个实例的程序,比如:QQ游戏.部分浏览器 等等! 让一个程序只运行一个实例的方法有多种,但是原理都类似,也就是在程序创建后,有窗口的程序在窗口创建前, 检查系统中是 ...
- git 如何revert指定范围内的commit并且只生成一个新的commit?
答:一共分成两步 一. revert多个commit并生成多个新的commit git revert <old commit>^..<new commit> 二. 使用reba ...
- Git如何修改一个过去的Commit
假设我的git log 如下: commit 5511533dda6fee6982175fafca1f4bd5692e3d9c (HEAD -> trans, origin/trans) Aut ...
- 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 ...
随机推荐
- <<杰克.韦尔奇自传>>
<<杰克.韦尔奇自传>> 这本书号称是管理学十大经典名著,也是HR老师推荐的一本书.花了几个月时间断断续续拜读了这本书. GE是伟大的公司,杰克韦尔奇是伟大的CEO,这都毋庸置 ...
- window下boost库
1.下载boost开发库源码. 2.使用vs2008的命令行工具,进入到源码目录xxx/boost_1_58_0,命令行中运行bootstrap.bat,生成文件b2.exe,在命令行中执行b2.ex ...
- 用 Sqlmap 识别 WAF
命令: ┌─[root@sch01ar]─[~] └──╼ #sqlmap -u "http://www.sch01ar.com/" --identify-waf --batch ...
- ubuntu用户添加adduser, useradd并给予sudo权限
ubuntu用户添加adduser, useradd并给予sudo权限 2016-06-15 10:36 1286人阅读 评论(0) 收藏 举报 分类: Ubuntu(80) ubuntu和win ...
- 【转】Android Studio打包全攻略---从入门到精通
原文地址:http://blog.csdn.net/zivensonice/article/details/51672846 初出茅庐 手动打包 怎么手动打包 项目写完了,现在需要把应用上传到市场,问 ...
- 如何在Oracle中向Collection类型的变量中逐条插入数据
这篇文章将要介绍如果需要生成一个新的Collection并且向其中添加数据的方法. procedure insert_object(d in dept_array, d2 out dept_array ...
- Java Servlet调用数据库复习
首先要导入jar包. 剩下的基本就是模版式的代码了: public class main { // JDBC 驱动名及数据库 URL static final String JDBC_DRIVER = ...
- LeetCode题解 #1 Two Sum
在LeetCode做的第一到题 题目大意:给出n个数,在其中找出和为一个特定数的两个数. Input: numbers={2, 7, 11, 15}, target=9Output: index1=1 ...
- leetcode503
public class Solution { public int[] NextGreaterElements(int[] nums) { int n = nums.Length; int[] ne ...
- Redis实战——redis主从复制和集群实现原理
出自:https://blog.csdn.net/nuli888/article/details/52136822 redis主从复制redis主从配置比较简单,基本就是在从节点配置文件加上:slav ...