Deprecated: Optional parameter $keys declared before required parameter $cms_id is implicitly treated as a required parameter in /home/www/dev/work/class/blog/CmsKey.php on line 75

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\main::$outlink is deprecated in /home/www/dev/work/website/lvesu/template/blog/cms/cms.tpl on line 2

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\main::$status is deprecated in /home/www/dev/work/website/lvesu/template/blog/index.head.php on line 2
git squash - 互联网笔记

略微加速

略速 - 互联网笔记

git squash

2022-07-19 leiting (1784阅读)

标签 Git

git squash

git merge中,每一次merge就会产生一个额外的commit,如果在工程中有许多bug和一些微小改变的commit,那么可以使用--squash选项将feature分支中的所有commit取出,然后压缩这些commit为一个并加入到master分支中。

具体指令如下:

git checkout master
git merge --squash feature12
  • 注意:上述的合并命令并不会创建一个commit,实际上就是将feature中的每一次commit的更改应用到本地,所以还需要手动提交该commit:git commit -m <"your commit message">

合并结果如下:


北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3