zoukankan      html  css  js  c++  java
  • git 合并commit

     git 压缩  git rebase -i HEAD~4

    该命令执行后,会弹出一个编辑窗口,4次提交的commit倒序排列,最上面的是最早的提交,最下面的是最近一次提交

    然后保存退出,git会压缩提交历史,如果有冲突,需要修改,修改的时候要注意,保留最新的历史,不然我们的修改就丢弃了。修改以后要记得敲下面的命令:

    [plain] view plain copy
     
    1. git add .  
    2. git rebase --continue  

    如果你想放弃这次压缩的话,执行以下命令:

    [plain] view plain copy
     
    1. git rebase --abort  

    如果没有冲突,或者冲突已经解决,则会出现如下的编辑窗口:

    [plain] view plain copy
     
    1. # This is a combination of 4 commits.  
    2. # The first commit’s message is:  
    3. add center style indent  
    4.   
    5. # The 2nd commit’s message is:  
    6. add center style  
    7.   
    8. # The 3rd commit’s message is:  
    9. add center style  
    10.   
    11. # The 4th commit’s message is:  
    12. update templates  
    13.   
    14. # Please enter the commit message for your changes. Lines starting  
    15. # with ‘#’ will be ignored, and an empty message aborts the commit.  
  • 相关阅读:
    load custom class in drupal 8
    HEAD in Git
    composer version constraint 版本号前缀
    如何测试
    看待一段数据
    创建一个plugin
    eclipse的快捷方式
    .git文件夹的猜想
    本地可以但远程不行
    方法点不进去的原因
  • 原文地址:https://www.cnblogs.com/xuzishuai/p/9048850.html
Copyright © 2011-2022 走看看