path: root/
diff options
authorMarc Branchaud <>2010-03-24 20:34:04 (GMT)
committerJunio C Hamano <>2010-03-24 21:42:57 (GMT)
commitb499549401cb2b1f6c30d09681380fd519938eb0 (patch)
treeba31383bcfd4878a57abbc7f1dba5947f83eccd8 /
parent60dafdd37d7df358b6ff67b317dbe738b50ea6d6 (diff)
Teach rebase the --no-ff option.
For, --no-ff is a synonym for --force-rebase. For, --no-ff cherry-picks all the commits in the rebased branch, instead of fast-forwarding over any unchanged commits. --no-ff offers an alternative way to deal with reverted merges. Instead of "reverting the revert" you can use "rebase --no-ff" to recreate the branch with entirely new commits (they're new because at the very least the committer time is different). This obviates the need to revert the reversion, as you can re-merge the new topic branch directly. Added an addendum to revert-a-faulty-merge.txt describing the situation and how to use --no-ff to handle it. Signed-off-by: Marc Branchaud <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to '')
1 files changed, 7 insertions, 2 deletions
diff --git a/ b/
index 3e4fd14..d5468b0 100755
--- a/
+++ b/
@@ -20,6 +20,7 @@ v,verbose display a diffstat of what changed upstream
onto= rebase onto given branch instead of upstream
p,preserve-merges try to recreate merges instead of ignoring them
s,strategy= use the given merge strategy
+no-ff cherry-pick all commits, even if unchanged
m,merge always used (no-op)
i,interactive always used (no-op)
@@ -103,6 +104,7 @@ VERBOSE=
GIT_CHERRY_PICK_HELP=" After resolving the conflicts,
mark the corrected paths with 'git add <paths>', and
@@ -222,7 +224,7 @@ do_with_author () {
pick_one () {
- no_ff=
+ no_ff=$NEVER_FF
case "$1" in -n) sha1=$2; no_ff=t ;; *) sha1=$1 ;; esac
output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
test -d "$REWRITTEN" &&
@@ -742,6 +744,9 @@ first and then run 'git rebase --continue' again."
# yeah, we know
+ --no-ff)
+ ;;
@@ -927,7 +932,7 @@ EOF
has_action "$TODO" ||
die_abort "Nothing to do"
- test -d "$REWRITTEN" || skip_unnecessary_picks
+ test -d "$REWRITTEN" || test -n "$NEVER_FF" || skip_unnecessary_picks
git update-ref ORIG_HEAD $HEAD
output git checkout $ONTO && do_rest