Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用git rebase时自动跳过空提交_Git_Git Rebase - Fatal编程技术网

使用git rebase时自动跳过空提交

使用git rebase时自动跳过空提交,git,git-rebase,Git,Git Rebase,通常,您必须执行git rebase--skip,如果有一个自动跳过这些空提交的开关就好了。有人知道怎么做吗 G2-使用以下别名继续 G2的Url- 备忘单- #/bin/bash # #此命令用于恢复冲突(重设基础或合并) #它将巧妙地进行重基——必要时跳过 状态=$(“$GIT_EXE”g2brstatus) [$state=“rebase”]&&{ action=“--继续” 如果git diff index--quiet HEAD--;那么 echo“最后一次提交没有带来重大更改--跳过

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

G2-使用以下别名
继续

G2的Url- 备忘单-

#/bin/bash
#
#此命令用于恢复冲突(重设基础或合并)
#它将巧妙地进行重基——必要时跳过
状态=$(“$GIT_EXE”g2brstatus)
[$state=“rebase”]&&{
action=“--继续”
如果git diff index--quiet HEAD--;那么
echo“最后一次提交没有带来重大更改--跳过”
action=“--跳过”
fi
“$GIT_EXE”重新设置$action 2>/dev/null
}
[$state=“merge”]&&{
#计算未合并文件的数量
计数=$(“$GIT_EXE”ls文件--未合并的| wc-l)
[[$count-ne 0]]&&echo“恐怕您还有未合并的文件,请运行以解决冲突”| |“$GIT_EXE”提交
} 

这似乎很有帮助,但我希望一开始就做一次,比如“git rebase——跳过空”,而不是在每一次都停止。我会试试这个,但如果没有其他的结果,我不知道任何标志的基础上。请记住,在冲突解决之后跳过,git希望您知道是应该重新设置基础还是继续。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
}