代码之家  ›  专栏  ›  技术社区  ›  lellefood

空的合并提交可以让我重新生成

git
  •  0
  • lellefood  · 技术社区  · 7 年前

    我有一个 staging 分支,从中获取空的合并提交 feature/amazing .
    现在我想合并 特色/惊人 在里面 分段 但我不能,因为吉特告诉我这都是最新的。我该怎么办?

    2 回复  |  直到 7 年前
        1
  •  1
  •   Marlon Abeykoon    7 年前

    git reset --hard <sha of the commit you want to point the HEAD to> 
    

    git log

    --hard feature/amazing

        2
  •  0
  •   Nimeshka Srimal    7 年前

    git commit --amend -m 'your new commit message'
    

    Git manual page

    --amend
        Replace the tip of the current branch by creating a new commit. The
        recorded tree is prepared as usual (including the effect of the -i and
        -o options and explicit pathspec), and the message from the original
        commit is used as the starting point, instead of an empty message, when
        no other message is specified from the command line via options such as
        -m, -F, -c, etc. The new commit has the same parents and author as the
        current one (the --reset-author option can countermand this).
    
    
        It is a rough equivalent for:
    
            $ git reset --soft HEAD^
            $ ... do something else to come up with the right tree ...
            $ git commit -c ORIG_HEAD
    
        but can be used to amend a merge commit.