Git取消提交违约在交互式变基 - Git de-selects a commit be default in interactive rebase

- 此内容更新于:2016-02-02
主题:

当我运行git交互式变基在一根树枝上git出于某种原因决定,我不希望下面的提交:这怎么可能?我没有注释掉这条线/提交自己。

原文:

When I run git interactive rebase on a branch git for some reason decides that I don't want the 9df79 commit below:

enter image description here

How is that possible?

I have NOT commented out that line/commit myself.

解决方案:
“空”的默认提交是下降了(见你粘贴的评论第35行图像),通过这个代码在交互式变基设置:设置变量的基础上(或)国旗你供应在命令行上,所以没有空non-merge提交出来。(一个“空”的提交的源代码树与母公司相同。)
原文:

"Empty" commits are dropped by default (see the comment on line 35 in your pasted-in image), via this bit of code in the setup for an interactive rebase:

git rev-list $merges_option --pretty=oneline --reverse --left-right --topo-order \
        $revisions ${restrict_revision+^$restrict_revision} | \
        sed -n "s/^>//p" |
while read -r sha1 rest
do

        if test -z "$keep_empty" && is_empty_commit $sha1 && ! is_merge_commit $sha1
        then
                comment_out="$comment_char "
        else
                comment_out=
        fi

The $keep_empty variable is set based on the --keep-empty (or -k) flag you supply on the command line, so without it non-empty non-merge commits come out as # pick ....

(An "empty" commit is one whose source tree is identical to its parent's.)