blob: d8d4bb79dc4912253f7c28dd89e2b0dfa1d9d0e2 [file] [log] [blame]
Benedikt Böhm00ccea62010-01-26 12:39:36 +01001#
Vincent Driessen6c2d30b2010-01-26 22:18:36 +01002# git-flow -- A collection of Git extensions to provide high-level
3# repository operations for Vincent Driessen's branching model.
Benedikt Böhm00ccea62010-01-26 12:39:36 +01004#
5# Original blog post presenting this model is found at:
6# http://nvie.com/archives/323
7#
8# Feel free to contribute to this project at:
9# http://github.com/nvie/gitflow
10#
11# Copyright (c) 2010 by Vincent Driessen
12# Copyright (c) 2010 by Benedikt Böhm
13#
14
Vincent Driessen7832d6e2010-02-21 21:31:03 +010015require_git_repo
16require_gitflow_initialized
Vincent Driessend72e4ac2010-02-16 21:33:51 +010017gitflow_load_settings
Vincent Driessenc1598bf2010-02-20 16:52:48 +010018PREFIX=$(git config --get gitflow.prefix.feature)
Benedikt Böhm49dd62b2010-01-28 00:51:15 +010019
Benedikt Böhm00ccea62010-01-26 12:39:36 +010020usage() {
Vincent Driessenb03cf962010-02-01 22:00:39 +010021 echo "usage: git flow feature [list] [-v]"
Vincent Driessena2e41162010-02-24 01:37:07 +010022 echo " git flow feature start [-Ff] <name> [<base>]"
23 echo " git flow feature finish [-rF] <name|nameprefix>"
Vincent Driessen186d2b52010-01-27 23:48:39 +010024 echo " git flow feature publish <name>"
25 echo " git flow feature track <name>"
Vincent Driessena2e41162010-02-24 01:37:07 +010026 echo " git flow feature diff [<name|nameprefix>]"
27 echo " git flow feature rebase [-i] [<name|nameprefix>]"
Benedikt Böhm00ccea62010-01-26 12:39:36 +010028}
29
Vincent Driessen186d2b52010-01-27 23:48:39 +010030cmd_default() {
Vincent Driessenb866b012010-01-28 01:01:53 +010031 cmd_list "$@"
Benedikt Böhm00ccea62010-01-26 12:39:36 +010032}
33
Vincent Driessenb866b012010-01-28 01:01:53 +010034cmd_list() {
Vincent Driessen44174922010-02-02 23:53:21 +010035 DEFINE_boolean verbose false 'verbose (more) output' v
Vincent Driessen1b819232010-02-01 15:51:43 +010036 parse_args "$@"
37
Vincent Driessenf46e2902010-02-15 23:01:52 +010038 local feature_branches
39 local current_branch
40 local short_names
Vincent Driessen7832d6e2010-02-21 21:31:03 +010041 feature_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
Vincent Driessen27592dd2010-02-06 14:45:39 +010042 if [ -z "$feature_branches" ]; then
Vincent Driessen186d2b52010-01-27 23:48:39 +010043 warn "No feature branches exist."
44 exit 0
45 fi
Vincent Driessen27592dd2010-02-06 14:45:39 +010046 current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
47 short_names=$(echo "$feature_branches" | sed "s ^$PREFIX g")
Vincent Driessenf2536f42010-02-01 15:57:48 +010048
Vincent Driessenaa6d0162010-02-01 19:43:46 +010049 # determine column width first
Vincent Driessenf46e2902010-02-15 23:01:52 +010050 local width=0
51 local branch
Vincent Driessen27592dd2010-02-06 14:45:39 +010052 for branch in $short_names; do
Vincent Driessenf46e2902010-02-15 23:01:52 +010053 local len=${#branch}
Vincent Driessenaa6d0162010-02-01 19:43:46 +010054 width=$(max $width $len)
55 done
Vincent Driessenf46e2902010-02-15 23:01:52 +010056 width=$(($width+3))
Vincent Driessen1adbc3e2010-01-30 16:28:20 +010057
Vincent Driessenf46e2902010-02-15 23:01:52 +010058 local branch
Vincent Driessen27592dd2010-02-06 14:45:39 +010059 for branch in $short_names; do
Vincent Driessenf46e2902010-02-15 23:01:52 +010060 local fullname=$PREFIX$branch
61 local base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
62 local develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
63 local branch_sha=$(git rev-parse "$fullname")
Vincent Driessen27592dd2010-02-06 14:45:39 +010064 if [ "$fullname" = "$current_branch" ]; then
Vincent Driessenaa6d0162010-02-01 19:43:46 +010065 printf "* "
66 else
67 printf " "
68 fi
Vincent Driessen44174922010-02-02 23:53:21 +010069 if flag verbose; then
Vincent Driessen1adbc3e2010-01-30 16:28:20 +010070 printf "%-${width}s" "$branch"
Vincent Driessenf2536f42010-02-01 15:57:48 +010071 if [ "$branch_sha" = "$develop_sha" ]; then
72 printf "(no commits yet)"
73 elif [ "$base" = "$branch_sha" ]; then
74 printf "(is behind develop, may ff)"
75 elif [ "$base" = "$develop_sha" ]; then
76 printf "(based on latest develop)"
77 else
78 printf "(may be rebased)"
79 fi
Vincent Driessenaa6d0162010-02-01 19:43:46 +010080 else
81 printf "%s" "$branch"
82 fi
83 echo
84 done
Vincent Driessen186d2b52010-01-27 23:48:39 +010085}
86
Benedikt Böhm00ccea62010-01-26 12:39:36 +010087cmd_help() {
88 usage
89 exit 0
90}
91
Vincent Driessend0991262010-02-06 21:19:07 +010092require_name_arg() {
Vincent Driessen1b819232010-02-01 15:51:43 +010093 if [ "$NAME" = "" ]; then
Vincent Driessen3c337fb2010-02-04 11:30:18 +010094 warn "Missing argument <name>"
Vincent Driessen1b819232010-02-01 15:51:43 +010095 usage
Vincent Driessen2e1856b2010-01-29 15:18:13 +010096 exit 1
97 fi
98}
99
Vincent Driessend0991262010-02-06 21:19:07 +0100100expand_nameprefix_arg() {
101 require_name_arg
102
Vincent Driessenf46e2902010-02-15 23:01:52 +0100103 local expanded_name
104 local exitcode
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100105 expanded_name=$(gitflow_resolve_nameprefix "$NAME" "$PREFIX")
Vincent Driessend0991262010-02-06 21:19:07 +0100106 exitcode=$?
107 case $exitcode in
108 0) NAME=$expanded_name
109 BRANCH=$PREFIX$NAME
110 ;;
111 *) exit 1 ;;
112 esac
Vincent Driessen2e1856b2010-01-29 15:18:13 +0100113}
114
Vincent Driessend0991262010-02-06 21:19:07 +0100115expand_nameprefix_arg_or_current() {
Vincent Driessenc62633f2010-02-02 10:48:50 +0100116 if [ "$NAME" != "" ]; then
Vincent Driessend0991262010-02-06 21:19:07 +0100117 expand_nameprefix_arg
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100118 require_branch "$PREFIX$NAME"
Vincent Driessenc62633f2010-02-02 10:48:50 +0100119 else
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100120 local current_branch=$(git_current_branch)
Vincent Driessend0991262010-02-06 21:19:07 +0100121 if startswith "$current_branch" "$PREFIX"; then
122 BRANCH=$current_branch
123 NAME=${BRANCH#$PREFIX}
124 else
125 warn "The current HEAD is no feature branch."
126 warn "To diff a feature, specify a <name> argument."
127 usage
128 exit 1
129 fi
Vincent Driessenc62633f2010-02-02 10:48:50 +0100130 fi
131}
132
Vincent Driessenea608952010-01-29 16:56:29 +0100133parse_args() {
Vincent Driessen1b819232010-02-01 15:51:43 +0100134 # parse options
135 FLAGS "$@" || exit $?
136 eval set -- "${FLAGS_ARGV}"
137
138 # read arguments into global variables
Vincent Driessenc5fcc012010-02-10 00:18:08 +0100139 NAME=$1
Vincent Driessen11560922010-02-01 21:58:37 +0100140 BRANCH=$PREFIX$NAME
Vincent Driessenb866b012010-01-28 01:01:53 +0100141}
142
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100143cmd_start() {
Vincent Driessen44174922010-02-02 23:53:21 +0100144 DEFINE_boolean fetch false 'fetch from origin before performing local operation' F
Vincent Driessen5455a6f2010-02-03 00:14:05 +0100145 DEFINE_boolean force false 'force creation of feature branch (ignores dirty working tree)' f
Vincent Driessenea608952010-01-29 16:56:29 +0100146 parse_args "$@"
Vincent Driessenc5fcc012010-02-10 00:18:08 +0100147 BASE=${2:-$DEVELOP_BRANCH}
Vincent Driessend0991262010-02-06 21:19:07 +0100148 require_name_arg
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100149
150 # sanity checks
Vincent Driessen5455a6f2010-02-03 00:14:05 +0100151 if noflag force; then
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100152 require_clean_working_tree
Vincent Driessen5455a6f2010-02-03 00:14:05 +0100153 fi
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100154 require_branch_absent "$BRANCH"
Vincent Driessene034e4a2010-01-29 12:10:44 +0100155
156 # update the local repo with remote changes, if asked
Vincent Driessen44174922010-02-02 23:53:21 +0100157 if flag fetch; then
Vincent Driessena4dd2232010-02-10 00:34:59 +0100158 git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100159 fi
160
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100161 require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
Vincent Driessene034e4a2010-01-29 12:10:44 +0100162
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100163 # create branch
Vincent Driessena4dd2232010-02-10 00:34:59 +0100164 if ! git checkout -b "$BRANCH" "$BASE"; then
Vincent Driessen5455a6f2010-02-03 00:14:05 +0100165 die "Could not create feature branch '$BRANCH'"
166 fi
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100167
168 echo
169 echo "Summary of actions:"
170 echo "- A new branch '$BRANCH' was created, based on '$BASE'"
171 echo "- You are now on branch '$BRANCH'"
172 echo ""
173 echo "Now, start committing on your feature. When done, use:"
174 echo ""
175 echo " git flow finish feature $NAME"
176 echo
177}
178
179cmd_finish() {
Vincent Driessenca73caf2010-02-07 19:46:38 +0100180 DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
Vincent Driessen44174922010-02-02 23:53:21 +0100181 DEFINE_boolean rebase false 'rebase instead of merge' r
Vincent Driessen1b819232010-02-01 15:51:43 +0100182 parse_args "$@"
Vincent Driessend0991262010-02-06 21:19:07 +0100183 expand_nameprefix_arg
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100184
185 # sanity checks
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100186 require_branch "$BRANCH"
Vincent Driessene034e4a2010-01-29 12:10:44 +0100187
Vincent Driessen49c7d022010-01-28 12:40:33 +0100188 # detect if we're restoring from a merge conflict
Vincent Driessencf6e92a2010-02-19 19:44:48 +0100189 if [ -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE" ]; then
Vincent Driessen49c7d022010-01-28 12:40:33 +0100190 #
191 # TODO: detect that we're working on the correct branch here!
192 # The user need not necessarily have given the same $NAME twice here
193 # (although he/she should).
194 #
Vincent Driessenf6f152f2010-01-29 10:28:08 +0100195
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100196 # TODO: git_is_clean_working_tree() should provide an alternative
Vincent Driessenf6f152f2010-01-29 10:28:08 +0100197 # exit code for "unmerged changes in working tree", which we should
198 # actually be testing for here
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100199 if git_is_clean_working_tree; then
Vincent Driessencf6e92a2010-02-19 19:44:48 +0100200 FINISH_BASE=$(cat "$DOT_GIT_DIR/.gitflow/MERGE_BASE")
Vincent Driessenf6f152f2010-01-29 10:28:08 +0100201
202 # Since the working tree is now clean, either the user did a
203 # succesfull merge manually, or the merge was cancelled.
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100204 # We detect this using git_is_branch_merged_into()
205 if git_is_branch_merged_into "$BRANCH" "$FINISH_BASE"; then
Vincent Driessencf6e92a2010-02-19 19:44:48 +0100206 rm -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
Vincent Driessenf6f152f2010-01-29 10:28:08 +0100207 helper_finish_cleanup
208 exit 0
209 else
210 # If the user cancelled the merge and decided to wait until later,
211 # that's fine. But we have to acknowledge this by removing the
212 # MERGE_BASE file and continuing normal execution of the finish
Vincent Driessencf6e92a2010-02-19 19:44:48 +0100213 rm -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
Vincent Driessenf6f152f2010-01-29 10:28:08 +0100214 fi
Vincent Driessen49c7d022010-01-28 12:40:33 +0100215 else
216 echo
217 echo "Merge conflicts not resolved yet, use:"
218 echo " git mergetool"
219 echo " git commit"
220 echo
221 echo "You can then complete the finish by running it again:"
222 echo " git flow feature finish $NAME"
223 echo
224 exit 1
225 fi
226 fi
227
Vincent Driessenf6f152f2010-01-29 10:28:08 +0100228 # sanity checks
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100229 require_clean_working_tree
Vincent Driessenf6f152f2010-01-29 10:28:08 +0100230
Vincent Driessene034e4a2010-01-29 12:10:44 +0100231 # update local repo with remote changes first, if asked
Vincent Driessen44174922010-02-02 23:53:21 +0100232 if flag fetch; then
Vincent Driessena4dd2232010-02-10 00:34:59 +0100233 git fetch -q "$ORIGIN" "$BRANCH"
Vincent Driessene034e4a2010-01-29 12:10:44 +0100234 fi
235
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100236 if has "$ORIGIN/$BRANCH" "$(git_remote_branches)"; then
237 require_branches_equal "$BRANCH" "$ORIGIN/$BRANCH"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100238 fi
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100239 require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100240
Vincent Driessen95bf82c2010-02-02 11:58:37 +0100241 # if the user wants to rebase, do that first
Vincent Driessen44174922010-02-02 23:53:21 +0100242 if flag rebase; then
Vincent Driessen010252a2010-02-04 10:31:29 +0100243 if ! git flow feature rebase "$NAME" "$DEVELOP_BRANCH"; then
Vincent Driessen95bf82c2010-02-02 11:58:37 +0100244 warn "Finish was aborted due to conflicts during rebase."
245 warn "Please finish the rebase manually now."
246 warn "When finished, re-run:"
Vincent Driessen010252a2010-02-04 10:31:29 +0100247 warn " git flow feature finish '$NAME' '$DEVELOP_BRANCH'"
Vincent Driessen95bf82c2010-02-02 11:58:37 +0100248 exit 1
249 fi
250 fi
251
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100252 # merge into BASE
Vincent Driessena4dd2232010-02-10 00:34:59 +0100253 git checkout "$DEVELOP_BRANCH"
254 if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
255 git merge --ff "$BRANCH"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100256 else
Vincent Driessena4dd2232010-02-10 00:34:59 +0100257 git merge --no-ff "$BRANCH"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100258 fi
259
Vincent Driessen49c7d022010-01-28 12:40:33 +0100260 if [ $? -ne 0 ]; then
261 # oops.. we have a merge conflict!
Vincent Driessen010252a2010-02-04 10:31:29 +0100262 # write the given $DEVELOP_BRANCH to a temporary file (we need it later)
Vincent Driessencf6e92a2010-02-19 19:44:48 +0100263 mkdir -p "$DOT_GIT_DIR/.gitflow"
264 echo "$DEVELOP_BRANCH" > "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
Vincent Driessen49c7d022010-01-28 12:40:33 +0100265 echo
266 echo "There were merge conflicts. To resolve the merge conflict manually, use:"
267 echo " git mergetool"
268 echo " git commit"
269 echo
270 echo "You can then complete the finish by running it again:"
271 echo " git flow feature finish $NAME"
272 echo
273 exit 1
274 fi
275
276 # when no merge conflict is detected, just clean up the feature branch
277 helper_finish_cleanup
278}
279
280helper_finish_cleanup() {
Vincent Driessenf6f152f2010-01-29 10:28:08 +0100281 # sanity checks
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100282 require_branch "$BRANCH"
283 require_clean_working_tree
Vincent Driessenf6f152f2010-01-29 10:28:08 +0100284
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100285 # delete branch
Vincent Driessen44174922010-02-02 23:53:21 +0100286 if flag fetch; then
Vincent Driessena4dd2232010-02-10 00:34:59 +0100287 git push "$ORIGIN" ":refs/heads/$BRANCH"
Vincent Driesseneec73c62010-02-02 16:14:16 +0100288 fi
Vincent Driessena4dd2232010-02-10 00:34:59 +0100289 git branch -d "$BRANCH"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100290
291 echo
292 echo "Summary of actions:"
Vincent Driessen010252a2010-02-04 10:31:29 +0100293 echo "- The feature branch '$BRANCH' was merged into '$DEVELOP_BRANCH'"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100294 #echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported
295 echo "- Feature branch '$BRANCH' has been removed"
Vincent Driessen010252a2010-02-04 10:31:29 +0100296 echo "- You are now on branch '$DEVELOP_BRANCH'"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100297 echo
298}
299
300cmd_publish() {
Vincent Driessenea608952010-01-29 16:56:29 +0100301 parse_args "$@"
Vincent Driessend0991262010-02-06 21:19:07 +0100302 expand_nameprefix_arg
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100303
304 # sanity checks
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100305 require_clean_working_tree
306 require_branch "$BRANCH"
Vincent Driessena4dd2232010-02-10 00:34:59 +0100307 git fetch -q "$ORIGIN"
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100308 require_branch_absent "$ORIGIN/$BRANCH"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100309
310 # create remote branch
Vincent Driessena4dd2232010-02-10 00:34:59 +0100311 git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
312 git fetch -q "$ORIGIN"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100313
314 # configure remote tracking
Vincent Driessena4dd2232010-02-10 00:34:59 +0100315 git config "branch.$BRANCH.remote" "$ORIGIN"
316 git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
317 git checkout "$BRANCH"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100318
319 echo
320 echo "Summary of actions:"
321 echo "- A new remote branch '$BRANCH' was created"
322 echo "- The local branch '$BRANCH' was configured to track the remote branch"
323 echo "- You are now on branch '$BRANCH'"
324 echo
325}
326
327cmd_track() {
Vincent Driessenea608952010-01-29 16:56:29 +0100328 parse_args "$@"
Vincent Driessend0991262010-02-06 21:19:07 +0100329 require_name_arg
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100330
331 # sanity checks
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100332 require_clean_working_tree
333 require_branch_absent "$BRANCH"
Vincent Driessena4dd2232010-02-10 00:34:59 +0100334 git fetch -q "$ORIGIN"
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100335 require_branch "$ORIGIN/$BRANCH"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100336
337 # create tracking branch
Vincent Driessena4dd2232010-02-10 00:34:59 +0100338 git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
Benedikt Böhm00ccea62010-01-26 12:39:36 +0100339
340 echo
341 echo "Summary of actions:"
342 echo "- A new remote tracking branch '$BRANCH' was created"
343 echo "- You are now on branch '$BRANCH'"
344 echo
345}
Vincent Driessenbd4f0952010-01-27 13:57:15 +0100346
Vincent Driessenbd4f0952010-01-27 13:57:15 +0100347cmd_diff() {
Vincent Driessen1b819232010-02-01 15:51:43 +0100348 parse_args "$@"
Vincent Driessen1b819232010-02-01 15:51:43 +0100349
Vincent Driessen5474e462010-02-04 15:50:06 +0100350 if [ "$NAME" != "" ]; then
Vincent Driessend0991262010-02-06 21:19:07 +0100351 expand_nameprefix_arg
Vincent Driessena4dd2232010-02-10 00:34:59 +0100352 BASE=$(git merge-base "$DEVELOP_BRANCH" "$BRANCH")
353 git diff "$BASE..$BRANCH"
Vincent Driessen5474e462010-02-04 15:50:06 +0100354 else
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100355 if ! git_current_branch | grep -q "^$PREFIX"; then
Vincent Driessen5474e462010-02-04 15:50:06 +0100356 die "Not on a feature branch. Name one explicitly."
357 fi
358
Vincent Driessena4dd2232010-02-10 00:34:59 +0100359 BASE=$(git merge-base "$DEVELOP_BRANCH" HEAD)
360 git diff "$BASE"
Vincent Driessen5474e462010-02-04 15:50:06 +0100361 fi
Vincent Driessenbd4f0952010-01-27 13:57:15 +0100362}
Vincent Driessenc62633f2010-02-02 10:48:50 +0100363
364cmd_rebase() {
Vincent Driessen44174922010-02-02 23:53:21 +0100365 DEFINE_boolean interactive false 'do an interactive rebase' i
Vincent Driessenc62633f2010-02-02 10:48:50 +0100366 parse_args "$@"
Vincent Driessend0991262010-02-06 21:19:07 +0100367 expand_nameprefix_arg_or_current
Vincent Driessenc62633f2010-02-02 10:48:50 +0100368 warn "Will try to rebase '$NAME'..."
Vincent Driessen7832d6e2010-02-21 21:31:03 +0100369 require_clean_working_tree
370 require_branch "$BRANCH"
Vincent Driessenc62633f2010-02-02 10:48:50 +0100371
372 git checkout -q "$BRANCH"
Vincent Driessenf46e2902010-02-15 23:01:52 +0100373 local OPTS=
Vincent Driessen44174922010-02-02 23:53:21 +0100374 if flag interactive; then
Vincent Driessenc62633f2010-02-02 10:48:50 +0100375 OPTS="$OPTS -i"
376 fi
Vincent Driessen010252a2010-02-04 10:31:29 +0100377 git rebase $OPTS "$DEVELOP_BRANCH"
Vincent Driessenc62633f2010-02-02 10:48:50 +0100378}