16

通常,您必须这样做git rebase --skip,如果有一个开关可以自动跳过这些空提交,那就太好了。有人知道怎么做吗?

4

2 回答 2

2

G2 - 使用以下别名continue

到 G2 的网址 - https://github.com/orefalo/g2 备忘单 - http://orefalo.github.com/g2/

#!/bin/bash
#
# This command is used to resume a conflict, either rebase or merge
#  it will smartly do a rebase --skip when necessary

state=$("$GIT_EXE" g2brstatus)

[[ $state = "rebase" ]] && {

action="--continue"
if git diff-index --quiet HEAD --; then
    echo "The last commit brings no significant changes -- skipping"
    action="--skip"
fi

"$GIT_EXE" rebase $action 2> /dev/null

}

[[ $state = "merge" ]] && {
# Count the number of unmerged files
count=$("$GIT_EXE" ls-files --unmerged | wc -l)
[[ $count -ne 0 ]] && echo "I am afraid you still have unmerged files, please run <g mt> to resolv conflicts" ||"$GIT_EXE" commit
} 
于 2012-06-20T20:40:53.997 回答
1

很老的话题,但对我来说是搜索引擎上的第一个结果。

我终于发现有一个--empty参数可以取以下值之一:keep、drop、ask。

链接到文档: https ://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt---emptydropkeepask

所以你现在可以简单地做git rebase ... --empty=drop

于 2022-02-25T21:58:17.527 回答