X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-rebase.sh;h=f7b2b9401a90e5aa598daa6049ae5d33e5c5b157;hb=d1802851b0c112a065b43e3f83d631f867b7e1ce;hp=21c3d83c3ade9bfb0cdabb00928eab4606062c1a;hpb=62a4417b574ce5120882016fd7803b9bccf68a67;p=git.git diff --git a/git-rebase.sh b/git-rebase.sh index 21c3d83c..f7b2b940 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -4,24 +4,28 @@ # USAGE='[--onto ] []' -LONG_USAGE='If is specified, switch to that branch first. Then, -extract commits in the current branch that are not in , -and reconstruct the current on top of , discarding the original -development history. If --onto is specified, the history is -reconstructed on top of , instead of . For example, -while on "topic" branch: +LONG_USAGE='git-rebase applies to (or optionally to ) commits +from that do not appear in . When is not +specified it defaults to the current branch (HEAD). + +When git-rebase is complete, will be updated to point to the +newly created line of commit objects, so the previous line will not be +accessible unless there are other references to it already. + +Assuming the following history: A---B---C topic / D---E---F---G master - $ '"$0"' --onto master~1 master topic +The result of the following command: -would rewrite the history to look like this: + git-rebase --onto master~1 master topic + would be: - A'\''--B'\''--C'\'' topic - / + A'\''--B'\''--C'\'' topic + / D---E---F---G master ' @@ -71,7 +75,7 @@ esac # The upstream head must be given. Make sure it is valid. upstream_name="$1" upstream=`git rev-parse --verify "${upstream_name}^0"` || - die "invalid upsteram $upstream_name" + die "invalid upstream $upstream_name" # If a hook exists, give it a chance to interrupt if test -x "$GIT_DIR/hooks/pre-rebase" @@ -90,7 +94,7 @@ case "$#" in ;; *) branch_name=`git symbolic-ref HEAD` || die "No current branch" - branch_name=`expr "$branch_name" : 'refs/heads/\(.*\)'` + branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'` ;; esac branch=$(git-rev-parse --verify "${branch_name}^0") || exit @@ -103,7 +107,7 @@ onto=$(git-rev-parse --verify "${onto_name}^0") || exit # Check if we are already based on $onto, but this should be # done only when upstream and onto are the same. -if test "$upstream" = "onto" +if test "$upstream" = "$onto" then mb=$(git-merge-base "$onto" "$branch") if test "$mb" = "$onto"