2010-01-26 11:39:36 +00:00
|
|
|
#
|
2010-01-26 21:18:36 +00:00
|
|
|
# git-flow -- A collection of Git extensions to provide high-level
|
|
|
|
# repository operations for Vincent Driessen's branching model.
|
2010-01-26 11:39:36 +00:00
|
|
|
#
|
|
|
|
# Original blog post presenting this model is found at:
|
|
|
|
# http://nvie.com/archives/323
|
|
|
|
#
|
|
|
|
# Feel free to contribute to this project at:
|
|
|
|
# http://github.com/nvie/gitflow
|
|
|
|
#
|
|
|
|
# Copyright (c) 2010 by Vincent Driessen
|
|
|
|
# Copyright (c) 2010 by Benedikt Böhm
|
|
|
|
#
|
|
|
|
|
2010-02-21 20:31:03 +00:00
|
|
|
require_git_repo
|
|
|
|
require_gitflow_initialized
|
2010-02-16 20:33:51 +00:00
|
|
|
gitflow_load_settings
|
2010-02-20 15:52:48 +00:00
|
|
|
PREFIX=$(git config --get gitflow.prefix.feature)
|
2010-01-27 23:51:15 +00:00
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
usage() {
|
2010-02-01 21:00:39 +00:00
|
|
|
echo "usage: git flow feature [list] [-v]"
|
|
|
|
echo " git flow feature start [-Fv] <name> [<base>]"
|
2010-02-04 09:31:29 +00:00
|
|
|
echo " git flow feature finish [-rsFv] <name|nameprefix>"
|
2010-01-27 22:48:39 +00:00
|
|
|
echo " git flow feature publish <name>"
|
|
|
|
echo " git flow feature track <name>"
|
2010-01-29 15:56:29 +00:00
|
|
|
echo " git flow feature diff <name|nameprefix>"
|
2010-02-02 09:48:50 +00:00
|
|
|
echo " git flow feature rebase [-i] <name|nameprefix>"
|
2010-01-26 11:39:36 +00:00
|
|
|
}
|
|
|
|
|
2010-01-27 22:48:39 +00:00
|
|
|
cmd_default() {
|
2010-01-28 00:01:53 +00:00
|
|
|
cmd_list "$@"
|
2010-01-26 11:39:36 +00:00
|
|
|
}
|
|
|
|
|
2010-01-28 00:01:53 +00:00
|
|
|
cmd_list() {
|
2010-02-02 22:53:21 +00:00
|
|
|
DEFINE_boolean verbose false 'verbose (more) output' v
|
2010-02-01 14:51:43 +00:00
|
|
|
parse_args "$@"
|
|
|
|
|
2010-02-15 22:01:52 +00:00
|
|
|
local feature_branches
|
|
|
|
local current_branch
|
|
|
|
local short_names
|
2010-02-21 20:31:03 +00:00
|
|
|
feature_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
|
2010-02-06 13:45:39 +00:00
|
|
|
if [ -z "$feature_branches" ]; then
|
2010-01-27 22:48:39 +00:00
|
|
|
warn "No feature branches exist."
|
|
|
|
exit 0
|
|
|
|
fi
|
2010-02-06 13:45:39 +00:00
|
|
|
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
|
|
|
|
short_names=$(echo "$feature_branches" | sed "s ^$PREFIX g")
|
2010-02-01 14:57:48 +00:00
|
|
|
|
2010-02-01 18:43:46 +00:00
|
|
|
# determine column width first
|
2010-02-15 22:01:52 +00:00
|
|
|
local width=0
|
|
|
|
local branch
|
2010-02-06 13:45:39 +00:00
|
|
|
for branch in $short_names; do
|
2010-02-15 22:01:52 +00:00
|
|
|
local len=${#branch}
|
2010-02-01 18:43:46 +00:00
|
|
|
width=$(max $width $len)
|
|
|
|
done
|
2010-02-15 22:01:52 +00:00
|
|
|
width=$(($width+3))
|
2010-02-06 13:45:39 +00:00
|
|
|
|
2010-02-15 22:01:52 +00:00
|
|
|
local branch
|
2010-02-06 13:45:39 +00:00
|
|
|
for branch in $short_names; do
|
2010-02-15 22:01:52 +00:00
|
|
|
local fullname=$PREFIX$branch
|
|
|
|
local base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
|
|
|
|
local develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
|
|
|
|
local branch_sha=$(git rev-parse "$fullname")
|
2010-02-06 13:45:39 +00:00
|
|
|
if [ "$fullname" = "$current_branch" ]; then
|
2010-02-01 18:43:46 +00:00
|
|
|
printf "* "
|
|
|
|
else
|
|
|
|
printf " "
|
|
|
|
fi
|
2010-02-02 22:53:21 +00:00
|
|
|
if flag verbose; then
|
2010-01-30 15:28:20 +00:00
|
|
|
printf "%-${width}s" "$branch"
|
2010-02-01 14:57:48 +00:00
|
|
|
if [ "$branch_sha" = "$develop_sha" ]; then
|
|
|
|
printf "(no commits yet)"
|
|
|
|
elif [ "$base" = "$branch_sha" ]; then
|
|
|
|
printf "(is behind develop, may ff)"
|
|
|
|
elif [ "$base" = "$develop_sha" ]; then
|
|
|
|
printf "(based on latest develop)"
|
|
|
|
else
|
|
|
|
printf "(may be rebased)"
|
|
|
|
fi
|
2010-02-01 18:43:46 +00:00
|
|
|
else
|
|
|
|
printf "%s" "$branch"
|
|
|
|
fi
|
|
|
|
echo
|
|
|
|
done
|
2010-01-27 22:48:39 +00:00
|
|
|
}
|
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
cmd_help() {
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2010-02-06 20:19:07 +00:00
|
|
|
require_name_arg() {
|
2010-02-01 14:51:43 +00:00
|
|
|
if [ "$NAME" = "" ]; then
|
2010-02-04 10:30:18 +00:00
|
|
|
warn "Missing argument <name>"
|
2010-02-01 14:51:43 +00:00
|
|
|
usage
|
2010-01-29 14:18:13 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-02-06 20:19:07 +00:00
|
|
|
expand_nameprefix_arg() {
|
|
|
|
require_name_arg
|
|
|
|
|
2010-02-15 22:01:52 +00:00
|
|
|
local expanded_name
|
|
|
|
local exitcode
|
2010-02-21 20:31:03 +00:00
|
|
|
expanded_name=$(gitflow_resolve_nameprefix "$NAME" "$PREFIX")
|
2010-02-06 20:19:07 +00:00
|
|
|
exitcode=$?
|
|
|
|
case $exitcode in
|
|
|
|
0) NAME=$expanded_name
|
|
|
|
BRANCH=$PREFIX$NAME
|
|
|
|
;;
|
|
|
|
*) exit 1 ;;
|
|
|
|
esac
|
2010-01-29 14:18:13 +00:00
|
|
|
}
|
|
|
|
|
2010-02-06 20:19:07 +00:00
|
|
|
expand_nameprefix_arg_or_current() {
|
2010-02-02 09:48:50 +00:00
|
|
|
if [ "$NAME" != "" ]; then
|
2010-02-06 20:19:07 +00:00
|
|
|
expand_nameprefix_arg
|
2010-02-21 20:31:03 +00:00
|
|
|
require_branch "$PREFIX$NAME"
|
2010-02-02 09:48:50 +00:00
|
|
|
else
|
2010-02-21 20:31:03 +00:00
|
|
|
local current_branch=$(git_current_branch)
|
2010-02-06 20:19:07 +00:00
|
|
|
if startswith "$current_branch" "$PREFIX"; then
|
|
|
|
BRANCH=$current_branch
|
|
|
|
NAME=${BRANCH#$PREFIX}
|
|
|
|
else
|
|
|
|
warn "The current HEAD is no feature branch."
|
|
|
|
warn "To diff a feature, specify a <name> argument."
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
2010-02-02 09:48:50 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-01-29 15:56:29 +00:00
|
|
|
parse_args() {
|
2010-02-01 14:51:43 +00:00
|
|
|
# parse options
|
|
|
|
FLAGS "$@" || exit $?
|
|
|
|
eval set -- "${FLAGS_ARGV}"
|
|
|
|
|
|
|
|
# read arguments into global variables
|
2010-02-09 23:18:08 +00:00
|
|
|
NAME=$1
|
2010-02-01 20:58:37 +00:00
|
|
|
BRANCH=$PREFIX$NAME
|
2010-01-28 00:01:53 +00:00
|
|
|
}
|
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
cmd_start() {
|
2010-02-02 22:53:21 +00:00
|
|
|
DEFINE_boolean fetch false 'fetch from origin before performing local operation' F
|
2010-02-02 23:14:05 +00:00
|
|
|
DEFINE_boolean force false 'force creation of feature branch (ignores dirty working tree)' f
|
2010-01-29 15:56:29 +00:00
|
|
|
parse_args "$@"
|
2010-02-09 23:18:08 +00:00
|
|
|
BASE=${2:-$DEVELOP_BRANCH}
|
2010-02-06 20:19:07 +00:00
|
|
|
require_name_arg
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
# sanity checks
|
2010-02-02 23:14:05 +00:00
|
|
|
if noflag force; then
|
2010-02-21 20:31:03 +00:00
|
|
|
require_clean_working_tree
|
2010-02-02 23:14:05 +00:00
|
|
|
fi
|
2010-02-21 20:31:03 +00:00
|
|
|
require_branch_absent "$BRANCH"
|
2010-01-29 11:10:44 +00:00
|
|
|
|
|
|
|
# update the local repo with remote changes, if asked
|
2010-02-02 22:53:21 +00:00
|
|
|
if flag fetch; then
|
2010-02-09 23:34:59 +00:00
|
|
|
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
|
2010-01-26 11:39:36 +00:00
|
|
|
fi
|
|
|
|
|
2010-02-21 20:31:03 +00:00
|
|
|
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
|
2010-01-29 11:10:44 +00:00
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
# create branch
|
2010-02-09 23:34:59 +00:00
|
|
|
if ! git checkout -b "$BRANCH" "$BASE"; then
|
2010-02-02 23:14:05 +00:00
|
|
|
die "Could not create feature branch '$BRANCH'"
|
|
|
|
fi
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Summary of actions:"
|
|
|
|
echo "- A new branch '$BRANCH' was created, based on '$BASE'"
|
|
|
|
echo "- You are now on branch '$BRANCH'"
|
|
|
|
echo ""
|
|
|
|
echo "Now, start committing on your feature. When done, use:"
|
|
|
|
echo ""
|
|
|
|
echo " git flow finish feature $NAME"
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd_finish() {
|
2010-02-07 18:46:38 +00:00
|
|
|
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
|
2010-02-02 22:53:21 +00:00
|
|
|
DEFINE_boolean rebase false 'rebase instead of merge' r
|
2010-02-01 14:51:43 +00:00
|
|
|
parse_args "$@"
|
2010-02-06 20:19:07 +00:00
|
|
|
expand_nameprefix_arg
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
# sanity checks
|
2010-02-21 20:31:03 +00:00
|
|
|
require_branch "$BRANCH"
|
2010-01-29 11:10:44 +00:00
|
|
|
|
2010-01-28 11:40:33 +00:00
|
|
|
# detect if we're restoring from a merge conflict
|
2010-02-19 18:44:48 +00:00
|
|
|
if [ -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE" ]; then
|
2010-01-28 11:40:33 +00:00
|
|
|
#
|
|
|
|
# TODO: detect that we're working on the correct branch here!
|
|
|
|
# The user need not necessarily have given the same $NAME twice here
|
|
|
|
# (although he/she should).
|
|
|
|
#
|
2010-01-29 09:28:08 +00:00
|
|
|
|
2010-02-21 20:31:03 +00:00
|
|
|
# TODO: git_is_clean_working_tree() should provide an alternative
|
2010-01-29 09:28:08 +00:00
|
|
|
# exit code for "unmerged changes in working tree", which we should
|
|
|
|
# actually be testing for here
|
2010-02-21 20:31:03 +00:00
|
|
|
if git_is_clean_working_tree; then
|
2010-02-19 18:44:48 +00:00
|
|
|
FINISH_BASE=$(cat "$DOT_GIT_DIR/.gitflow/MERGE_BASE")
|
2010-01-29 09:28:08 +00:00
|
|
|
|
|
|
|
# Since the working tree is now clean, either the user did a
|
|
|
|
# succesfull merge manually, or the merge was cancelled.
|
2010-02-21 20:31:03 +00:00
|
|
|
# We detect this using git_is_branch_merged_into()
|
|
|
|
if git_is_branch_merged_into "$BRANCH" "$FINISH_BASE"; then
|
2010-02-19 18:44:48 +00:00
|
|
|
rm -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
|
2010-01-29 09:28:08 +00:00
|
|
|
helper_finish_cleanup
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
# If the user cancelled the merge and decided to wait until later,
|
|
|
|
# that's fine. But we have to acknowledge this by removing the
|
|
|
|
# MERGE_BASE file and continuing normal execution of the finish
|
2010-02-19 18:44:48 +00:00
|
|
|
rm -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
|
2010-01-29 09:28:08 +00:00
|
|
|
fi
|
2010-01-28 11:40:33 +00:00
|
|
|
else
|
|
|
|
echo
|
|
|
|
echo "Merge conflicts not resolved yet, use:"
|
|
|
|
echo " git mergetool"
|
|
|
|
echo " git commit"
|
|
|
|
echo
|
|
|
|
echo "You can then complete the finish by running it again:"
|
|
|
|
echo " git flow feature finish $NAME"
|
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-01-29 09:28:08 +00:00
|
|
|
# sanity checks
|
2010-02-21 20:31:03 +00:00
|
|
|
require_clean_working_tree
|
2010-01-29 09:28:08 +00:00
|
|
|
|
2010-01-29 11:10:44 +00:00
|
|
|
# update local repo with remote changes first, if asked
|
2010-02-02 22:53:21 +00:00
|
|
|
if flag fetch; then
|
2010-02-09 23:34:59 +00:00
|
|
|
git fetch -q "$ORIGIN" "$BRANCH"
|
2010-01-29 11:10:44 +00:00
|
|
|
fi
|
|
|
|
|
2010-02-21 20:31:03 +00:00
|
|
|
if has "$ORIGIN/$BRANCH" "$(git_remote_branches)"; then
|
|
|
|
require_branches_equal "$BRANCH" "$ORIGIN/$BRANCH"
|
2010-01-26 11:39:36 +00:00
|
|
|
fi
|
2010-02-21 20:31:03 +00:00
|
|
|
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
|
2010-01-26 11:39:36 +00:00
|
|
|
|
2010-02-02 10:58:37 +00:00
|
|
|
# if the user wants to rebase, do that first
|
2010-02-02 22:53:21 +00:00
|
|
|
if flag rebase; then
|
2010-02-04 09:31:29 +00:00
|
|
|
if ! git flow feature rebase "$NAME" "$DEVELOP_BRANCH"; then
|
2010-02-02 10:58:37 +00:00
|
|
|
warn "Finish was aborted due to conflicts during rebase."
|
|
|
|
warn "Please finish the rebase manually now."
|
|
|
|
warn "When finished, re-run:"
|
2010-02-04 09:31:29 +00:00
|
|
|
warn " git flow feature finish '$NAME' '$DEVELOP_BRANCH'"
|
2010-02-02 10:58:37 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
# merge into BASE
|
2010-02-09 23:34:59 +00:00
|
|
|
git checkout "$DEVELOP_BRANCH"
|
|
|
|
if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
|
|
|
|
git merge --ff "$BRANCH"
|
2010-01-26 11:39:36 +00:00
|
|
|
else
|
2010-02-09 23:34:59 +00:00
|
|
|
git merge --no-ff "$BRANCH"
|
2010-01-26 11:39:36 +00:00
|
|
|
fi
|
|
|
|
|
2010-01-28 11:40:33 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
# oops.. we have a merge conflict!
|
2010-02-04 09:31:29 +00:00
|
|
|
# write the given $DEVELOP_BRANCH to a temporary file (we need it later)
|
2010-02-19 18:44:48 +00:00
|
|
|
mkdir -p "$DOT_GIT_DIR/.gitflow"
|
|
|
|
echo "$DEVELOP_BRANCH" > "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
|
2010-01-28 11:40:33 +00:00
|
|
|
echo
|
|
|
|
echo "There were merge conflicts. To resolve the merge conflict manually, use:"
|
|
|
|
echo " git mergetool"
|
|
|
|
echo " git commit"
|
|
|
|
echo
|
|
|
|
echo "You can then complete the finish by running it again:"
|
|
|
|
echo " git flow feature finish $NAME"
|
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# when no merge conflict is detected, just clean up the feature branch
|
|
|
|
helper_finish_cleanup
|
|
|
|
}
|
|
|
|
|
|
|
|
helper_finish_cleanup() {
|
2010-01-29 09:28:08 +00:00
|
|
|
# sanity checks
|
2010-02-21 20:31:03 +00:00
|
|
|
require_branch "$BRANCH"
|
|
|
|
require_clean_working_tree
|
2010-01-29 09:28:08 +00:00
|
|
|
|
2010-01-26 11:39:36 +00:00
|
|
|
# delete branch
|
2010-02-02 22:53:21 +00:00
|
|
|
if flag fetch; then
|
2010-02-09 23:34:59 +00:00
|
|
|
git push "$ORIGIN" ":refs/heads/$BRANCH"
|
2010-02-02 15:14:16 +00:00
|
|
|
fi
|
2010-02-09 23:34:59 +00:00
|
|
|
git branch -d "$BRANCH"
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Summary of actions:"
|
2010-02-04 09:31:29 +00:00
|
|
|
echo "- The feature branch '$BRANCH' was merged into '$DEVELOP_BRANCH'"
|
2010-01-26 11:39:36 +00:00
|
|
|
#echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported
|
|
|
|
echo "- Feature branch '$BRANCH' has been removed"
|
2010-02-04 09:31:29 +00:00
|
|
|
echo "- You are now on branch '$DEVELOP_BRANCH'"
|
2010-01-26 11:39:36 +00:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd_publish() {
|
2010-01-29 15:56:29 +00:00
|
|
|
parse_args "$@"
|
2010-02-06 20:19:07 +00:00
|
|
|
expand_nameprefix_arg
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
# sanity checks
|
2010-02-21 20:31:03 +00:00
|
|
|
require_clean_working_tree
|
|
|
|
require_branch "$BRANCH"
|
2010-02-09 23:34:59 +00:00
|
|
|
git fetch -q "$ORIGIN"
|
2010-02-21 20:31:03 +00:00
|
|
|
require_branch_absent "$ORIGIN/$BRANCH"
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
# create remote branch
|
2010-02-09 23:34:59 +00:00
|
|
|
git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
|
|
|
|
git fetch -q "$ORIGIN"
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
# configure remote tracking
|
2010-02-09 23:34:59 +00:00
|
|
|
git config "branch.$BRANCH.remote" "$ORIGIN"
|
|
|
|
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
|
|
|
|
git checkout "$BRANCH"
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Summary of actions:"
|
|
|
|
echo "- A new remote branch '$BRANCH' was created"
|
|
|
|
echo "- The local branch '$BRANCH' was configured to track the remote branch"
|
|
|
|
echo "- You are now on branch '$BRANCH'"
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd_track() {
|
2010-01-29 15:56:29 +00:00
|
|
|
parse_args "$@"
|
2010-02-06 20:19:07 +00:00
|
|
|
require_name_arg
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
# sanity checks
|
2010-02-21 20:31:03 +00:00
|
|
|
require_clean_working_tree
|
|
|
|
require_branch_absent "$BRANCH"
|
2010-02-09 23:34:59 +00:00
|
|
|
git fetch -q "$ORIGIN"
|
2010-02-21 20:31:03 +00:00
|
|
|
require_branch "$ORIGIN/$BRANCH"
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
# create tracking branch
|
2010-02-09 23:34:59 +00:00
|
|
|
git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
|
2010-01-26 11:39:36 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Summary of actions:"
|
|
|
|
echo "- A new remote tracking branch '$BRANCH' was created"
|
|
|
|
echo "- You are now on branch '$BRANCH'"
|
|
|
|
echo
|
|
|
|
}
|
2010-01-27 12:57:15 +00:00
|
|
|
|
|
|
|
cmd_diff() {
|
2010-02-01 14:51:43 +00:00
|
|
|
parse_args "$@"
|
|
|
|
|
2010-02-04 14:50:06 +00:00
|
|
|
if [ "$NAME" != "" ]; then
|
2010-02-06 20:19:07 +00:00
|
|
|
expand_nameprefix_arg
|
2010-02-09 23:34:59 +00:00
|
|
|
BASE=$(git merge-base "$DEVELOP_BRANCH" "$BRANCH")
|
|
|
|
git diff "$BASE..$BRANCH"
|
2010-02-04 14:50:06 +00:00
|
|
|
else
|
2010-02-21 20:31:03 +00:00
|
|
|
if ! git_current_branch | grep -q "^$PREFIX"; then
|
2010-02-04 14:50:06 +00:00
|
|
|
die "Not on a feature branch. Name one explicitly."
|
|
|
|
fi
|
|
|
|
|
2010-02-09 23:34:59 +00:00
|
|
|
BASE=$(git merge-base "$DEVELOP_BRANCH" HEAD)
|
|
|
|
git diff "$BASE"
|
2010-02-04 14:50:06 +00:00
|
|
|
fi
|
2010-01-27 12:57:15 +00:00
|
|
|
}
|
2010-02-02 09:48:50 +00:00
|
|
|
|
|
|
|
cmd_rebase() {
|
2010-02-02 22:53:21 +00:00
|
|
|
DEFINE_boolean interactive false 'do an interactive rebase' i
|
2010-02-02 09:48:50 +00:00
|
|
|
parse_args "$@"
|
2010-02-06 20:19:07 +00:00
|
|
|
expand_nameprefix_arg_or_current
|
2010-02-02 09:48:50 +00:00
|
|
|
warn "Will try to rebase '$NAME'..."
|
2010-02-21 20:31:03 +00:00
|
|
|
require_clean_working_tree
|
|
|
|
require_branch "$BRANCH"
|
2010-02-02 09:48:50 +00:00
|
|
|
|
|
|
|
git checkout -q "$BRANCH"
|
2010-02-15 22:01:52 +00:00
|
|
|
local OPTS=
|
2010-02-02 22:53:21 +00:00
|
|
|
if flag interactive; then
|
2010-02-02 09:48:50 +00:00
|
|
|
OPTS="$OPTS -i"
|
|
|
|
fi
|
2010-02-04 09:31:29 +00:00
|
|
|
git rebase $OPTS "$DEVELOP_BRANCH"
|
2010-02-02 09:48:50 +00:00
|
|
|
}
|