美文网首页
合并/删除多个commit

合并/删除多个commit

作者: DOB_8199 | 来源:发表于2021-05-25 14:48 被阅读0次

参考文档:https://juejin.cn/post/6844903600976576519

如图出现了多个commit如何合并成一个:

    1. git log 找到这两个commit的版本号(马赛克的地方)

    2.  git rebase -i HEAD~2

        rebase从head往下数两个(进去之后可以改版本号,所以这里你需要改几个就写几个)

        p, pick = use commit

        r, reword = use commit, but edit the commit message

        e, edit = use commit, but stop for amending

        s, squash = use commit, but meld into previous commit

        f, fixup = like "squash", but discard this commit's log message

        x, exec = run command (the rest of the line) using shell

        d, drop = remove commit

如果要移除,必须有一个pick,否则会移除该分支所有提交!!!(基本所有操作都需要有一个版本号在pick命令上)

相关文章

网友评论

      本文标题:合并/删除多个commit

      本文链接:https://www.haomeiwen.com/subject/mppqsltx.html