Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 1 | # |
Vincent Driessen | 6c2d30b | 2010-01-26 22:18:36 +0100 | [diff] [blame] | 2 | # git-flow -- A collection of Git extensions to provide high-level |
| 3 | # repository operations for Vincent Driessen's branching model. |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 4 | # |
| 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 | |
Benedikt Böhm | 49dd62b | 2010-01-28 00:51:15 +0100 | [diff] [blame] | 15 | PREFIX=$(git config --get gitflow.prefix.feature || echo feature/) |
| 16 | |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 17 | usage() { |
Vincent Driessen | b866b01 | 2010-01-28 01:01:53 +0100 | [diff] [blame] | 18 | echo "usage: git flow feature [list]" |
Vincent Driessen | 186d2b5 | 2010-01-27 23:48:39 +0100 | [diff] [blame] | 19 | echo " git flow feature start <name> [<base>]" |
Vincent Driessen | ea60895 | 2010-01-29 16:56:29 +0100 | [diff] [blame] | 20 | echo " git flow feature finish <name|nameprefix> [<base>]" |
Vincent Driessen | 186d2b5 | 2010-01-27 23:48:39 +0100 | [diff] [blame] | 21 | echo " git flow feature publish <name>" |
| 22 | echo " git flow feature track <name>" |
Vincent Driessen | ea60895 | 2010-01-29 16:56:29 +0100 | [diff] [blame] | 23 | echo " git flow feature diff <name|nameprefix>" |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 24 | # TODO |
| 25 | #echo "" |
| 26 | #echo "options:" |
| 27 | #echo "--option Explanation" |
| 28 | #echo "" |
| 29 | #echo "start-only options:" |
| 30 | #echo "--option Explanation" |
| 31 | #echo "" |
| 32 | #echo "finish-only options:" |
| 33 | #echo "--rebase Rebases the feature branch on top of develop, instead of merging" |
| 34 | #echo "--squash Squashes all commits of the feature branch into a single commit" |
| 35 | #echo " on develop" |
| 36 | #echo "--push Push to the origin repo when finished" |
| 37 | } |
| 38 | |
Vincent Driessen | 186d2b5 | 2010-01-27 23:48:39 +0100 | [diff] [blame] | 39 | cmd_default() { |
Vincent Driessen | b866b01 | 2010-01-28 01:01:53 +0100 | [diff] [blame] | 40 | cmd_list "$@" |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 41 | } |
| 42 | |
Vincent Driessen | 1adbc3e | 2010-01-30 16:28:20 +0100 | [diff] [blame] | 43 | max() { if [ "$1" -gt "$2" ]; then echo "$1"; else echo "$2"; fi; } |
| 44 | |
Vincent Driessen | b866b01 | 2010-01-28 01:01:53 +0100 | [diff] [blame] | 45 | cmd_list() { |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 46 | DEFINE_boolean verbose 0 'verbose (more) output' v |
| 47 | parse_args "$@" |
| 48 | |
Vincent Driessen | 186d2b5 | 2010-01-27 23:48:39 +0100 | [diff] [blame] | 49 | FEATURE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")" |
| 50 | if [ -z "$FEATURE_BRANCHES" ]; then |
| 51 | warn "No feature branches exist." |
| 52 | exit 0 |
| 53 | fi |
Vincent Driessen | f2536f4 | 2010-02-01 15:57:48 +0100 | [diff] [blame] | 54 | |
| 55 | SHORT_NAMES=$(echo "$FEATURE_BRANCHES" | sed "s?^$PREFIX??g") |
| 56 | if [ $FLAGS_verbose -eq 0 ]; then |
| 57 | echo "$SHORT_NAMES" |
| 58 | else |
Vincent Driessen | 1adbc3e | 2010-01-30 16:28:20 +0100 | [diff] [blame] | 59 | # determine column width first |
| 60 | width=0 |
| 61 | for branch in $SHORT_NAMES; do |
| 62 | len=$(($(echo "$branch" | wc -c) - 1)) |
| 63 | width=$(max $width $len) |
| 64 | done |
| 65 | width=$(($width + 3)) |
| 66 | |
Vincent Driessen | f2536f4 | 2010-02-01 15:57:48 +0100 | [diff] [blame] | 67 | for branch in $SHORT_NAMES; do |
| 68 | fullname="$PREFIX$branch" |
| 69 | base=$(git merge-base "$fullname" "$DEVELOP_BRANCH") |
| 70 | develop_sha=$(git rev-parse "$DEVELOP_BRANCH") |
| 71 | branch_sha=$(git rev-parse "$fullname") |
Vincent Driessen | 1adbc3e | 2010-01-30 16:28:20 +0100 | [diff] [blame] | 72 | printf "%-${width}s" "$branch" |
Vincent Driessen | f2536f4 | 2010-02-01 15:57:48 +0100 | [diff] [blame] | 73 | if [ "$branch_sha" = "$develop_sha" ]; then |
| 74 | printf "(no commits yet)" |
| 75 | elif [ "$base" = "$branch_sha" ]; then |
| 76 | printf "(is behind develop, may ff)" |
| 77 | elif [ "$base" = "$develop_sha" ]; then |
| 78 | printf "(based on latest develop)" |
| 79 | else |
| 80 | printf "(may be rebased)" |
| 81 | fi |
| 82 | echo |
| 83 | done |
| 84 | fi |
Vincent Driessen | 186d2b5 | 2010-01-27 23:48:39 +0100 | [diff] [blame] | 85 | } |
| 86 | |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 87 | cmd_help() { |
| 88 | usage |
| 89 | exit 0 |
| 90 | } |
| 91 | |
Vincent Driessen | 22ef21a | 2010-01-29 16:43:37 +0100 | [diff] [blame] | 92 | resolve_name_by_prefix() { |
Vincent Driessen | 2e1856b | 2010-01-29 15:18:13 +0100 | [diff] [blame] | 93 | # first, check if there is a perfect match |
Vincent Driessen | 22ef21a | 2010-01-29 16:43:37 +0100 | [diff] [blame] | 94 | if has "$LOCAL_BRANCHES" "$PREFIX$1"; then |
| 95 | echo "$1" |
| 96 | return 0 |
Vincent Driessen | 2e1856b | 2010-01-29 15:18:13 +0100 | [diff] [blame] | 97 | fi |
| 98 | |
| 99 | MATCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX$1")" |
| 100 | NUM_MATCHES=$(echo "$MATCHES" | wc -l) |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 101 | if [ -z "$MATCHES" ]; then |
Vincent Driessen | 2e1856b | 2010-01-29 15:18:13 +0100 | [diff] [blame] | 102 | # no prefix match, so take it literally |
| 103 | echo "$1" |
| 104 | else |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 105 | if [ $NUM_MATCHES -eq 1 ]; then |
| 106 | # sed arg looks a bit weird, but $PREFIX should not contain spaces, |
| 107 | # so this one is safe |
| 108 | echo "$MATCHES" | sed "s $PREFIX g" |
| 109 | else |
| 110 | # multiple matches, cannot decide |
| 111 | warn "Multiple branches match for prefix '$1':" |
| 112 | for match in $MATCHES; do |
| 113 | warn "- $match" |
| 114 | done |
| 115 | die "Aborting. Use an unambiguous prefix." |
| 116 | fi |
Vincent Driessen | 2e1856b | 2010-01-29 15:18:13 +0100 | [diff] [blame] | 117 | fi |
| 118 | } |
| 119 | |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 120 | require_name() { |
| 121 | if [ "$NAME" = "" ]; then |
| 122 | echo "Missing argument <name>" |
| 123 | usage |
Vincent Driessen | 2e1856b | 2010-01-29 15:18:13 +0100 | [diff] [blame] | 124 | exit 1 |
| 125 | fi |
| 126 | } |
| 127 | |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 128 | expand_name_arg_prefix() { |
| 129 | require_name |
| 130 | NAME=$(resolve_name_by_prefix "$NAME") |
| 131 | if echo "$NAME" | grep -q "^[ \t\n\r]+$"; then |
Vincent Driessen | 2e1856b | 2010-01-29 15:18:13 +0100 | [diff] [blame] | 132 | exit 1 |
| 133 | fi |
| 134 | BRANCH=$PREFIX$NAME |
| 135 | } |
| 136 | |
Vincent Driessen | ea60895 | 2010-01-29 16:56:29 +0100 | [diff] [blame] | 137 | parse_args() { |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 138 | # parse options |
| 139 | FLAGS "$@" || exit $? |
| 140 | eval set -- "${FLAGS_ARGV}" |
| 141 | |
| 142 | # read arguments into global variables |
Vincent Driessen | b866b01 | 2010-01-28 01:01:53 +0100 | [diff] [blame] | 143 | NAME="$1" |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 144 | BASE="${2:-$DEVELOP_BRANCH}" |
Vincent Driessen | b866b01 | 2010-01-28 01:01:53 +0100 | [diff] [blame] | 145 | } |
| 146 | |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 147 | cmd_start() { |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 148 | DEFINE_boolean fetch 0 'fetch from origin before performing local operation' F |
Vincent Driessen | ea60895 | 2010-01-29 16:56:29 +0100 | [diff] [blame] | 149 | parse_args "$@" |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 150 | require_name |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 151 | |
| 152 | # sanity checks |
Vincent Driessen | 4838644 | 2010-01-29 10:30:40 +0100 | [diff] [blame] | 153 | gitflow_require_clean_working_tree |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 154 | gitflow_require_branch_absent $BRANCH |
Vincent Driessen | e034e4a | 2010-01-29 12:10:44 +0100 | [diff] [blame] | 155 | |
| 156 | # update the local repo with remote changes, if asked |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 157 | if [ $FLAGS_fetch -eq 1 ]; then |
Benedikt Böhm | 4d22227 | 2010-01-26 14:46:56 +0100 | [diff] [blame] | 158 | git fetch -q $ORIGIN $DEVELOP_BRANCH |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 159 | fi |
| 160 | |
Vincent Driessen | e034e4a | 2010-01-29 12:10:44 +0100 | [diff] [blame] | 161 | gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH |
| 162 | |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 163 | # create branch |
| 164 | git checkout -b $BRANCH $BASE |
| 165 | |
| 166 | echo |
| 167 | echo "Summary of actions:" |
| 168 | echo "- A new branch '$BRANCH' was created, based on '$BASE'" |
| 169 | echo "- You are now on branch '$BRANCH'" |
| 170 | echo "" |
| 171 | echo "Now, start committing on your feature. When done, use:" |
| 172 | echo "" |
| 173 | echo " git flow finish feature $NAME" |
| 174 | echo |
| 175 | } |
| 176 | |
| 177 | cmd_finish() { |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 178 | DEFINE_boolean fetch 0 'fetch from origin before performing local operation' F |
| 179 | DEFINE_boolean rebase 0 'rebase instead of merge' r |
| 180 | DEFINE_boolean squash 0 'squash all commits when rebasing (implies --rebase)' s |
| 181 | parse_args "$@" |
| 182 | expand_name_arg_prefix |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 183 | |
| 184 | # sanity checks |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 185 | gitflow_require_branch $BRANCH |
Vincent Driessen | e034e4a | 2010-01-29 12:10:44 +0100 | [diff] [blame] | 186 | |
Vincent Driessen | 49c7d02 | 2010-01-28 12:40:33 +0100 | [diff] [blame] | 187 | # detect if we're restoring from a merge conflict |
| 188 | if [ -f "$GIT_DIR/.gitflow/MERGE_BASE" ]; then |
| 189 | # |
| 190 | # TODO: detect that we're working on the correct branch here! |
| 191 | # The user need not necessarily have given the same $NAME twice here |
| 192 | # (although he/she should). |
| 193 | # |
Vincent Driessen | f6f152f | 2010-01-29 10:28:08 +0100 | [diff] [blame] | 194 | |
| 195 | # TODO: gitflow_test_clean_working_tree() should provide an alternative |
| 196 | # exit code for "unmerged changes in working tree", which we should |
| 197 | # actually be testing for here |
| 198 | if gitflow_test_clean_working_tree; then |
| 199 | FINISH_BASE="$(cat "$GIT_DIR/.gitflow/MERGE_BASE")" |
| 200 | |
| 201 | # Since the working tree is now clean, either the user did a |
| 202 | # succesfull merge manually, or the merge was cancelled. |
| 203 | # We detect this using gitflow_is_branch_merged_into() |
| 204 | if gitflow_is_branch_merged_into $BRANCH $FINISH_BASE; then |
| 205 | rm -f "$GIT_DIR/.gitflow/MERGE_BASE" |
| 206 | helper_finish_cleanup |
| 207 | exit 0 |
| 208 | else |
| 209 | # If the user cancelled the merge and decided to wait until later, |
| 210 | # that's fine. But we have to acknowledge this by removing the |
| 211 | # MERGE_BASE file and continuing normal execution of the finish |
| 212 | rm -f "$GIT_DIR/.gitflow/MERGE_BASE" |
| 213 | fi |
Vincent Driessen | 49c7d02 | 2010-01-28 12:40:33 +0100 | [diff] [blame] | 214 | else |
| 215 | echo |
| 216 | echo "Merge conflicts not resolved yet, use:" |
| 217 | echo " git mergetool" |
| 218 | echo " git commit" |
| 219 | echo |
| 220 | echo "You can then complete the finish by running it again:" |
| 221 | echo " git flow feature finish $NAME" |
| 222 | echo |
| 223 | exit 1 |
| 224 | fi |
| 225 | fi |
| 226 | |
Vincent Driessen | f6f152f | 2010-01-29 10:28:08 +0100 | [diff] [blame] | 227 | # sanity checks |
| 228 | gitflow_require_clean_working_tree |
| 229 | |
Vincent Driessen | e034e4a | 2010-01-29 12:10:44 +0100 | [diff] [blame] | 230 | # update local repo with remote changes first, if asked |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 231 | if [ $FLAGS_fetch -eq 1 ]; then |
Vincent Driessen | e034e4a | 2010-01-29 12:10:44 +0100 | [diff] [blame] | 232 | git fetch -q $ORIGIN $BRANCH |
| 233 | fi |
| 234 | |
Benedikt Böhm | 350e715 | 2010-01-26 13:05:05 +0100 | [diff] [blame] | 235 | if has $ORIGIN/$BRANCH $REMOTE_BRANCHES; then |
| 236 | gitflow_require_branches_equal $BRANCH $ORIGIN/$BRANCH |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 237 | fi |
Benedikt Böhm | 4a864fb | 2010-01-26 12:59:27 +0100 | [diff] [blame] | 238 | if [ "$BASE" = "$DEVELOP_BRANCH" ]; then |
Benedikt Böhm | 350e715 | 2010-01-26 13:05:05 +0100 | [diff] [blame] | 239 | gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 240 | fi |
| 241 | |
| 242 | # merge into BASE |
| 243 | git checkout $BASE |
| 244 | if [ "$(git rev-list -n2 $BASE..$BRANCH | wc -l)" = "1" ]; then |
| 245 | git merge --ff $BRANCH |
| 246 | else |
| 247 | git merge --no-ff $BRANCH |
| 248 | fi |
| 249 | |
Vincent Driessen | 49c7d02 | 2010-01-28 12:40:33 +0100 | [diff] [blame] | 250 | if [ $? -ne 0 ]; then |
| 251 | # oops.. we have a merge conflict! |
| 252 | # write the given $BASE to a temporary file (we need it later) |
Vincent Driessen | f6f152f | 2010-01-29 10:28:08 +0100 | [diff] [blame] | 253 | mkdir -p "$GIT_DIR/.gitflow" |
Vincent Driessen | 49c7d02 | 2010-01-28 12:40:33 +0100 | [diff] [blame] | 254 | echo "$BASE" > "$GIT_DIR/.gitflow/MERGE_BASE" |
| 255 | echo |
| 256 | echo "There were merge conflicts. To resolve the merge conflict manually, use:" |
| 257 | echo " git mergetool" |
| 258 | echo " git commit" |
| 259 | echo |
| 260 | echo "You can then complete the finish by running it again:" |
| 261 | echo " git flow feature finish $NAME" |
| 262 | echo |
| 263 | exit 1 |
| 264 | fi |
| 265 | |
| 266 | # when no merge conflict is detected, just clean up the feature branch |
| 267 | helper_finish_cleanup |
| 268 | } |
| 269 | |
| 270 | helper_finish_cleanup() { |
Vincent Driessen | f6f152f | 2010-01-29 10:28:08 +0100 | [diff] [blame] | 271 | # sanity checks |
| 272 | gitflow_require_branch $BRANCH |
Vincent Driessen | 1ee37e7 | 2010-01-29 17:36:21 +0100 | [diff] [blame] | 273 | gitflow_require_clean_working_tree |
Vincent Driessen | f6f152f | 2010-01-29 10:28:08 +0100 | [diff] [blame] | 274 | |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 275 | # delete branch |
Benedikt Böhm | 350e715 | 2010-01-26 13:05:05 +0100 | [diff] [blame] | 276 | git push $ORIGIN :refs/heads/$BRANCH |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 277 | git branch -d $BRANCH |
| 278 | |
| 279 | echo |
| 280 | echo "Summary of actions:" |
| 281 | echo "- The feature branch '$BRANCH' was merged into '$BASE'" |
| 282 | #echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported |
| 283 | echo "- Feature branch '$BRANCH' has been removed" |
| 284 | echo "- You are now on branch '$BASE'" |
| 285 | echo |
| 286 | } |
| 287 | |
| 288 | cmd_publish() { |
Vincent Driessen | ea60895 | 2010-01-29 16:56:29 +0100 | [diff] [blame] | 289 | parse_args "$@" |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 290 | expand_name_arg_prefix |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 291 | |
| 292 | # sanity checks |
Vincent Driessen | 4838644 | 2010-01-29 10:30:40 +0100 | [diff] [blame] | 293 | gitflow_require_clean_working_tree |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 294 | gitflow_require_branch $BRANCH |
Benedikt Böhm | 4d22227 | 2010-01-26 14:46:56 +0100 | [diff] [blame] | 295 | git fetch -q $ORIGIN |
Benedikt Böhm | 350e715 | 2010-01-26 13:05:05 +0100 | [diff] [blame] | 296 | gitflow_require_branch_absent $ORIGIN/$BRANCH |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 297 | |
| 298 | # create remote branch |
Benedikt Böhm | 350e715 | 2010-01-26 13:05:05 +0100 | [diff] [blame] | 299 | git push $ORIGIN $BRANCH:refs/heads/$BRANCH |
Benedikt Böhm | 4d22227 | 2010-01-26 14:46:56 +0100 | [diff] [blame] | 300 | git fetch -q $ORIGIN |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 301 | |
| 302 | # configure remote tracking |
Benedikt Böhm | 350e715 | 2010-01-26 13:05:05 +0100 | [diff] [blame] | 303 | git config branch.$BRANCH.remote $ORIGIN |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 304 | git config branch.$BRANCH.merge refs/heads/$BRANCH |
| 305 | git checkout $BRANCH |
| 306 | |
| 307 | echo |
| 308 | echo "Summary of actions:" |
| 309 | echo "- A new remote branch '$BRANCH' was created" |
| 310 | echo "- The local branch '$BRANCH' was configured to track the remote branch" |
| 311 | echo "- You are now on branch '$BRANCH'" |
| 312 | echo |
| 313 | } |
| 314 | |
| 315 | cmd_track() { |
Vincent Driessen | ea60895 | 2010-01-29 16:56:29 +0100 | [diff] [blame] | 316 | parse_args "$@" |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 317 | require_name |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 318 | |
| 319 | # sanity checks |
Vincent Driessen | 4838644 | 2010-01-29 10:30:40 +0100 | [diff] [blame] | 320 | gitflow_require_clean_working_tree |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 321 | gitflow_require_branch_absent $BRANCH |
Benedikt Böhm | 4d22227 | 2010-01-26 14:46:56 +0100 | [diff] [blame] | 322 | git fetch -q $ORIGIN |
Benedikt Böhm | 350e715 | 2010-01-26 13:05:05 +0100 | [diff] [blame] | 323 | gitflow_require_branch $ORIGIN/$BRANCH |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 324 | |
| 325 | # create tracking branch |
Benedikt Böhm | 350e715 | 2010-01-26 13:05:05 +0100 | [diff] [blame] | 326 | git checkout -b $BRANCH $ORIGIN/$BRANCH |
Benedikt Böhm | 00ccea6 | 2010-01-26 12:39:36 +0100 | [diff] [blame] | 327 | |
| 328 | echo |
| 329 | echo "Summary of actions:" |
| 330 | echo "- A new remote tracking branch '$BRANCH' was created" |
| 331 | echo "- You are now on branch '$BRANCH'" |
| 332 | echo |
| 333 | } |
Vincent Driessen | bd4f095 | 2010-01-27 13:57:15 +0100 | [diff] [blame] | 334 | |
Vincent Driessen | bd4f095 | 2010-01-27 13:57:15 +0100 | [diff] [blame] | 335 | cmd_diff() { |
Vincent Driessen | 1b81923 | 2010-02-01 15:51:43 +0100 | [diff] [blame] | 336 | parse_args "$@" |
| 337 | expand_name_arg_prefix |
| 338 | |
Vincent Driessen | bd4f095 | 2010-01-27 13:57:15 +0100 | [diff] [blame] | 339 | # TODO: if this feature has been based on a non-develop branch, we really |
| 340 | # should not be comparing to $DEVELOP. How to deal with this? |
Vincent Driessen | 278884b | 2010-01-28 16:29:34 +0100 | [diff] [blame] | 341 | git diff $DEVELOP_BRANCH..$BRANCH |
Vincent Driessen | bd4f095 | 2010-01-27 13:57:15 +0100 | [diff] [blame] | 342 | } |