Show current git interactive rebase operation

后端 未结 2 913
无人及你
无人及你 2021-01-04 22:17

When in the middle of an interactive rebase, e.g. git rebase -i HEAD~12 and adding/editing some commits, I\'m often confused as to which commit I\'m editing, es

2条回答
  •  星月不相逢
    2021-01-04 22:57

    When in the middle of an interactive rebase, e.g. git rebase -i HEAD~12 and adding/editing some commits, I'm often confused as to which commit I'm editing

    With Git 2.17 (Q2 2018), the new "--show-current-patch" option gives an end-user facing way to get the diff being applied when "git rebase" (and "git am") stops with a conflict.

    See commit fbd7a23, commit 6633529, commit 984913a (11 Feb 2018) by Nguyễn Thái Ngọc Duy (pclouds).
    Helped-by: Tim Landscheidt (scfc).
    (Merged by Junio C Hamano -- gitster -- in commit 9ca488c, 06 Mar 2018)

    rebase: introduce and use pseudo-ref REBASE_HEAD

    The new command git rebase --show-current-patch is useful for seeing the commit related to the current rebase state.
    Some however may find the "git show" command behind it too limiting.
    You may want to increase context lines, do a diff that ignores whitespaces...

    For these advanced use cases, the user can execute any command they want with the new pseudo ref REBASE_HEAD.

    This also helps show where the stopped commit is from, which is hard to see from the previous patch which implements --show-current-patch.

    See also, with Git 2.26 (Q2 2020), the new git rebase/am --show-current-patchd=diff mode.

提交回复
热议问题