博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
git cherry-pick改写提交
阅读量:2118 次
发布时间:2019-04-30

本文共 623 字,大约阅读时间需要 2 分钟。

教程3 改写提交!

4. cherry-pick

为了节省时间,这个教程使用现有的历史记录作为本地数据库。

下载

我们进入stepup-tutorial/tutorial4目录。本地端历史记录的状态如下图显示。仅把在其他分支执行的「添加commit的讲解」的修改导入到master分支。

数据库的历史记录

把修改移动到master分支后,用cherry-pick 取出「添加commit的讲解」提交,然后将其添加到master。(文档里的提交"99daed2"和下载到数据库里的提交有可能不相同。在下载的数据库里执行git log,确认是正确的提交之后再使用。)

$ git checkout masterSwitched to branch 'master'$ git cherry-pick 99daed2error: could not apply 99daed2... commithint: after resolving the conflicts, mark the corrected pathshint: with 'git add 
' or 'git rm
'hint: and commit the result with 'git commit'

如果发生冲突,就打开sample.txt,修改冲突的部分之后再提交。

$ git add sample.txt$ git commit

转载地址:http://wwgef.baihongyu.com/

你可能感兴趣的文章
剑指offer 38.丑数
查看>>
剑指offer 39.构建乘积数组
查看>>
剑指offer 57. 删除链表中重复的结点
查看>>
剑指offer 58. 链表中环的入口结点
查看>>
剑指offer 59. 把字符串转换成整数
查看>>
剑指offer 60. 不用加减乘除做加法
查看>>
leetcode 热题 Hot 100-3. 合并两个有序链表
查看>>
leetcode 热题 Hot 100-4. 对称二叉树
查看>>
Leetcode C++《热题 Hot 100-12》226.翻转二叉树
查看>>
Leetcode C++《热题 Hot 100-13》234.回文链表
查看>>
Leetcode C++《热题 Hot 100-14》283.移动零
查看>>
Leetcode C++《热题 Hot 100-15》437.路径总和III
查看>>
Leetcode C++《热题 Hot 100-17》461.汉明距离
查看>>
Leetcode C++《热题 Hot 100-18》538.把二叉搜索树转换为累加树
查看>>
Leetcode C++《热题 Hot 100-19》543.二叉树的直径
查看>>
Leetcode C++《热题 Hot 100-21》581.最短无序连续子数组
查看>>
Leetcode C++《热题 Hot 100-22》2.两数相加
查看>>
Leetcode C++《热题 Hot 100-23》3.无重复字符的最长子串
查看>>
Leetcode C++《热题 Hot 100-24》5.最长回文子串
查看>>
Leetcode C++《热题 Hot 100-26》15.三数之和
查看>>