git merge --squash 选项合并commit操作实例

 参考:

[转] git merge 将多个commit合并为一条之--squash 选项

git checkout master

git pull origin master  # 本地先拉取最新的master,最后目标是要merge到master

git branch feature-123-merge  # 从master创建一个新的专门用来做merge的新branch:feature-123-merge

git checkout feature-123-merge

git merge --squash feature-123  # 这里把原来有n多commit的feature-123的branch合并到feature-123-merge

git commit -m "feature-123: A test change for merging with squash"  # commit一次,然后push

git push origin feature-123-merge:feature-123-merge  # 这时候在服务器上的feature-123-merge就只有最新的这一次commit,可以pull request再merge到master了

原文地址:https://www.cnblogs.com/pekkle/p/12071849.html

时间: 2024-07-31 06:14:54

git merge --squash 选项合并commit操作实例的相关文章

[转] git merge 将多个commit合并为一条之--squash 选项

[FROM] https://blog.csdn.net/themagickeyjianan/article/details/80333645 1.一般的做法(直接git merge) Git相对于CVS和SVN的一大好处就是merge非常方便,只要指出branch的名字就好了,如: $ git merge another $ git checkout another # modify, commit, modify, commit ... $ git checkout master $ git

git merge –squash介绍

Git相对于CVS和SVN的一大好处就是merge非常方便,只要指出branch的名字就好了,如: $ git merge another $ git checkout another # modify, commit, modify, commit ... $ git checkout master $ git merge another 但是,操作方便并不意味着这样操作就是合理的,在某些情况下,我们应该优先选择使用--squash选项,如下: $ git merge --squash ano

聊下git merge --squash

你经常会面临着将dev分支或者很多零散的分支merge到一个公共release分支里. 但是有一种情况是需要你处理的,就是在你的dev的分支里有很多commit记录.而这些commit是无需在release里体现的. develop 主分支 develop主分支最近的一个commit是"fix imageprint bug.".我们拉出一个分支进行项目开发,里面会有很多commit记录. git checkout -b develop_newfeature_ImportDataInte

git merge时merge/squash merge/rebase merge的区别

1. merge $ git checkout master $ git merge dev 这是最基本的 merge,会把分支的提交历史原封不动地拷贝过来,如果 master 此后已经有了新的提交,那么本次 merge 时还会额外自动创建一条 commit 信息用于记录本次 merge 操作. 2. squash merge $ git checkout master $ git merge --squash dev 字面意思,相比?merge?来说会减少分支合并的记录,会被压缩为一条 com

GIT分支创建和合并

之前代码管理一直用的是svn,但互联网的潮人们都在玩GIT,我也跟随潮流尝试慢慢转移到GIT上来,SVN和GIT操作上逻辑差异还是比较大的,边学习GIT边做个记录吧. 在开发一个功能时,可以通过创建分支的方式完成代码修改和提交,该功能相关人员可以在该分支上合作开发,比如目前已经有了develop分支,现在要创建一个issue1分支解决一个问题或者开发一个功能,完成修改后再合并到develop分支,那么我们需要做如下操作: 1.本地先创建一个分支(从当前分支创建,如develop,如果不是从当前分

三十八、git merge简介

git merge的基本用法为把一个分支或或某个commit的修改合并现在的分支上. 我们可以运行git merge -h查看其命令usage: git merge [options] [<commit>...]    or: git merge [options] <msg> HEAD <commit>    or: git merge --abort -n                    do not show a diffstat at the end of

git merge简介(转)

git merge的基本用法为把一个分支或或某个commit的修改合并现在的分支上.我们可以运行git merge -h和git merge --help查看其命令,后者会直接转到一个网页(git的帮助文档),更详细.usage: git merge [options] [<commit>...]   or: git merge [options] <msg> HEAD <commit>   or: git merge --abort -n               

git merge简介

git merge的基本用法为把一个分支或或某个commit的修改合并到现在的分支上.我们可以运行git merge -h和git merge --help查看其命令,后者会直接转到一个网页(git的帮助文档),更详细.usage: git merge [options] [<commit>...]   or: git merge [options] <msg> HEAD <commit>   or: git merge --abort -n              

git merge的使用

在实际开发中经常会用到git merge操作.但很多情况下我们并不想合并后直接提交,这里介绍git merge的两个常用参数: --no-commit --no-commit 参数使得合并后,为了防止合并失败并不自动提交,能够给使用者一个机会在提交前审视和修改合并结果.(这个使用后不会合并为一次commit) git merge --no-commit dev.master   // dev.master 是要合并的分支名称 --squash --squash 参数当一个合并发生时,从当前分支和