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 ...
随机推荐
- 在CentOS 7中使用VS Code编译调试C++项目
1. 安装VSCODE 见VSCode官方链接 https://code.visualstudio.com/docs/setup/linux#_rhel-fedora-and-centos-based ...
- oracle startup mount nomount 区别
看oracle入门书,其中一句话说,使用startup nomount 命令启动例程,不可以和mount open 和exclusive一起使用,这个命令适用于建立数据库或是维护数据库时使用. 于是查 ...
- [BZOJ][CQOI2014]数三角形
Description 给定一个nxm的网格,请计算三点都在格点上的三角形共有多少个.下图为4x4的网格上的一个三角形. 注意三角形的三点不能共线. Input 输入一行,包含两个空格分隔的正整数m和 ...
- Django-组件--用户认证Auth(auth_user增加字段)
引入: from django.db import models from django.contrib.auth.models import AbstractBaseUser 源码 : from d ...
- C# 生成序号不足补0
int Num=13 var code =Num.ToString().PadLeft(4, '0'); code:0013
- zookeeper的概念和基础
1.1ZooKeeper的使命 当开发人员使用ZooKeeper进行开发时,开发人员设计的那些应⽤往往可以看成成组连接到ZooKeeper服务器端的客户端,它们通过ZooKeeper的客户端API连接 ...
- mongodb分片(七)
1.插入负载技术分片架构图 2.片键的概念和用处 看下面这个普通的集合和分片后的结果 3.什么时候用到分片呢? 3.1机器的磁盘空间不足 3.2单个的mongoDB服务器已经不能满足大量的插入操作 3 ...
- django初体检课程
最简便的Python web开发框架. C:\Windows\System32>E: E:\>django-admin startproject mysite E:\>cd mysi ...
- C#多线程学习-求和
1.代码如下 // *********************************************************************** // Assembly : Shar ...
- <mvc:annotation-driven />讲解
<mvc:annotation-driven />是一种简写形式,完全可以手动配置替代这种简写形式,简写形式可以让初学者快速应用默认配置方案.<mvc:annotation-driv ...