Usually, you have to do git rebase --skip
, it would be nice if there was a switch to automatically skip over these empty commits. Anyone know how to do this?
-
It's a pain in the neck indeed. I just want to get the latest code asap and not be bothered with such a minor thing that can be fixed later.– Sridhar SarnobatApr 13, 2018 at 21:46
2 Answers
Very old topic, but for me was the first result on the search engine.
I finally found there is a --empty
parameter that can take one of the following values: keep, drop, and ask.
Link to the documentation: https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt---emptydropkeepask
So you now can simply do git rebase ... --empty=drop
-
-
1Would be nice to have this also for other commands like
am
:( Git is a mess in command parameters, not many consistency... Apr 11, 2022 at 8:59
G2 - uses the following alias continue
Url to G2 - https://github.com/orefalo/g2 Cheatsheet - 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
}
-
2That seems very helpful, but I'm looking to do it once at the beginning, something like "git rebase --skip-empty" rather than stop on each one. I will try this though if nothing else turns up– quinnJun 20, 2012 at 20:52
-
I don't know of any flags on rebase. remember you skip after a conflict resolution and git expects you to know if you should rebase or continue. g2 fixes that issue by figuring it out for you. You may change the script to you likings. Jun 21, 2012 at 0:03