aboutsummaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorMarc Branchaud <marcnarc@xiplink.com>2010-03-24 16:34:04 -0400
committerJunio C Hamano <gitster@pobox.com>2010-03-24 14:42:57 -0700
commitb499549401cb2b1f6c30d09681380fd519938eb0 (patch)
treeba31383bcfd4878a57abbc7f1dba5947f83eccd8 /git-rebase--interactive.sh
parent60dafdd37d7df358b6ff67b317dbe738b50ea6d6 (diff)
downloadgit-b499549401cb2b1f6c30d09681380fd519938eb0.tar.gz
git-b499549401cb2b1f6c30d09681380fd519938eb0.tar.xz
Teach rebase the --no-ff option.
For git-rebase.sh, --no-ff is a synonym for --force-rebase. For git-rebase--interactive.sh, --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 <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 3e4fd1456..d5468b047 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -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)
Actions:
@@ -103,6 +104,7 @@ VERBOSE=
OK_TO_SKIP_PRE_REBASE=
REBASE_ROOT=
AUTOSQUASH=
+NEVER_FF=
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."
-i)
# yeah, we know
;;
+ --no-ff)
+ NEVER_FF=t
+ ;;
--root)
REBASE_ROOT=t
;;
@@ -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