Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 366 lines (327 sloc) 11.306 kB
093a147 @nvie Added header comments to all files.
authored
1 #
6c2d30b @nvie Structurally replace gitflow by git-flow, as a true git extension.
authored
2 # git-flow -- A collection of Git extensions to provide high-level
3 # repository operations for Vincent Driessen's branching model.
00ccea6 @hollow refactor the whole thing
hollow authored
4 #
093a147 @nvie Added header comments to all files.
authored
5 # Original blog post presenting this model is found at:
ddb350b @nvie Change the URL of the original blog post.
authored
6 # http://nvie.com/git-model
00ccea6 @hollow refactor the whole thing
hollow authored
7 #
093a147 @nvie Added header comments to all files.
authored
8 # Feel free to contribute to this project at:
9 # http://github.com/nvie/gitflow
10 #
d72acba @nvie Added inline license terms to all source files.
authored
11 # Copyright 2010 Vincent Driessen. All rights reserved.
12 #
13 # Redistribution and use in source and binary forms, with or without
14 # modification, are permitted provided that the following conditions are met:
15 #
16 # 1. Redistributions of source code must retain the above copyright notice,
17 # this list of conditions and the following disclaimer.
18 #
19 # 2. Redistributions in binary form must reproduce the above copyright
20 # notice, this list of conditions and the following disclaimer in the
21 # documentation and/or other materials provided with the distribution.
22 #
23 # THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
24 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
26 # EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
30 # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32 # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #
34 # The views and conclusions contained in the software and documentation are
35 # those of the authors and should not be interpreted as representing official
36 # policies, either expressed or implied, of Vincent Driessen.
093a147 @nvie Added header comments to all files.
authored
37 #
f7f687c @nvie Also add basic skeleton implementation for the gitflow-feature and gi…
authored
38
dc902ed @pcragone Added 'init()' function to git-flow-{feature,release,hotfix,support},…
pcragone authored
39 init() {
40 require_git_repo
41 require_gitflow_initialized
42 gitflow_load_settings
43 VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
44 PREFIX=$(git config --get gitflow.prefix.release)
45 }
49dd62b @hollow refactor git config calls to global variables
hollow authored
46
f7f687c @nvie Also add basic skeleton implementation for the gitflow-feature and gi…
authored
47 usage() {
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
48 echo "usage: git flow release [list] [-v]"
2074360 release: start subcommand takes an optional base as well
Stefan Näwe authored
49 echo " git flow release start [-F] <version> [<base>]"
6fa8fed @mykehsd Release finish squash parameter
mykehsd authored
50 echo " git flow release finish [-FsumpkS] <version>"
bbca922 add the banner message to the release
Felipe Talavera authored
51 echo " git flow release publish <name>"
52 echo " git flow release track <name>"
f7f687c @nvie Also add basic skeleton implementation for the gitflow-feature and gi…
authored
53 }
54
170dc74 @nvie Refactored the feature, release and support subcommands, too.
authored
55 cmd_default() {
b866b01 @nvie Give all subcommands an optional setup() function that will be called…
authored
56 cmd_list "$@"
00ccea6 @hollow refactor the whole thing
hollow authored
57 }
58
b866b01 @nvie Give all subcommands an optional setup() function that will be called…
authored
59 cmd_list() {
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
60 DEFINE_boolean verbose false 'verbose (more) output' v
61 parse_args "$@"
62
f46e290 @nvie Replaced all 'typeset' and 'typeset -i' calls by 'local', as adviced on:
authored
63 local release_branches
64 local current_branch
65 local short_names
7832d6e @nvie Better naming of common functions categorizing them into common,
authored
66 release_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
27592dd @nvie Tidy up:
authored
67 if [ -z "$release_branches" ]; then
170dc74 @nvie Refactored the feature, release and support subcommands, too.
authored
68 warn "No release branches exist."
b681b45 @Zoramite Adding extra instructions when running the list option without any co…
Zoramite authored
69 warn ""
70 warn "You can start a new release branch:"
71 warn ""
72 warn " git flow release start <name> [<base>]"
4de01f2 @Zoramite Adding an extra line to the output for extra spacing.
Zoramite authored
73 warn ""
170dc74 @nvie Refactored the feature, release and support subcommands, too.
authored
74 exit 0
75 fi
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
76
cf3da5a @adamgibbins Fixed incorrect color flag
adamgibbins authored
77 current_branch=$(git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
6884523 @nvie Use space (' ') instead of '?' as a pattern terminator.
authored
78 short_names=$(echo "$release_branches" | sed "s ^$PREFIX g")
27592dd @nvie Tidy up:
authored
79
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
80 # determine column width first
f46e290 @nvie Replaced all 'typeset' and 'typeset -i' calls by 'local', as adviced on:
authored
81 local width=0
82 local branch
27592dd @nvie Tidy up:
authored
83 for branch in $short_names; do
f46e290 @nvie Replaced all 'typeset' and 'typeset -i' calls by 'local', as adviced on:
authored
84 local len=${#branch}
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
85 width=$(max $width $len)
86 done
f46e290 @nvie Replaced all 'typeset' and 'typeset -i' calls by 'local', as adviced on:
authored
87 width=$(($width+3))
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
88
f46e290 @nvie Replaced all 'typeset' and 'typeset -i' calls by 'local', as adviced on:
authored
89 local branch
27592dd @nvie Tidy up:
authored
90 for branch in $short_names; do
f46e290 @nvie Replaced all 'typeset' and 'typeset -i' calls by 'local', as adviced on:
authored
91 local fullname=$PREFIX$branch
92 local base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
93 local develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
94 local branch_sha=$(git rev-parse "$fullname")
27592dd @nvie Tidy up:
authored
95 if [ "$fullname" = "$current_branch" ]; then
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
96 printf "* "
97 else
98 printf " "
99 fi
100 if flag verbose; then
101 printf "%-${width}s" "$branch"
102 if [ "$branch_sha" = "$develop_sha" ]; then
103 printf "(no commits yet)"
104 else
f46e290 @nvie Replaced all 'typeset' and 'typeset -i' calls by 'local', as adviced on:
authored
105 local nicename=$(git rev-parse --short "$base")
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
106 printf "(based on $nicename)"
107 fi
108 else
109 printf "%s" "$branch"
110 fi
111 echo
112 done
170dc74 @nvie Refactored the feature, release and support subcommands, too.
authored
113 }
114
00ccea6 @hollow refactor the whole thing
hollow authored
115 cmd_help() {
116 usage
117 exit 0
f7f687c @nvie Also add basic skeleton implementation for the gitflow-feature and gi…
authored
118 }
119
b866b01 @nvie Give all subcommands an optional setup() function that will be called…
authored
120 parse_args() {
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
121 # parse options
122 FLAGS "$@" || exit $?
123 eval set -- "${FLAGS_ARGV}"
124
125 # read arguments into global variables
f1eaa4e @nvie Don't just take the last argument, take the first.
authored
126 VERSION=$1
c5fcc01 @nvie Do not quote variable assignments.
authored
127 BRANCH=$PREFIX$VERSION
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
128 }
129
130 require_version_arg() {
b866b01 @nvie Give all subcommands an optional setup() function that will be called…
authored
131 if [ "$VERSION" = "" ]; then
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
132 warn "Missing argument <version>"
b866b01 @nvie Give all subcommands an optional setup() function that will be called…
authored
133 usage
134 exit 1
135 fi
136 }
137
010252a @nvie Added an optional <base> argument to all start subactions.
authored
138 require_base_is_on_develop() {
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
139 if ! git_do branch --no-color --contains "$BASE" 2>/dev/null \
010252a @nvie Added an optional <base> argument to all start subactions.
authored
140 | sed 's/[* ] //g' \
141 | grep -q "^$DEVELOP_BRANCH\$"; then
142 die "fatal: Given base '$BASE' is not a valid commit on '$DEVELOP_BRANCH'."
143 fi
144 }
145
6d64d2c @nvie Add check to disallow creation of a new release/hotfix branch when there
authored
146 require_no_existing_release_branches() {
7832d6e @nvie Better naming of common functions categorizing them into common,
authored
147 local release_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
6d64d2c @nvie Add check to disallow creation of a new release/hotfix branch when there
authored
148 local first_branch=$(echo ${release_branches} | head -n1)
149 first_branch=${first_branch#$PREFIX}
150 [ -z "$release_branches" ] || \
151 die "There is an existing release branch ($first_branch). Finish that one first."
152 }
153
00ccea6 @hollow refactor the whole thing
hollow authored
154 cmd_start() {
de95e00 @nvie Change the default behaviour of all scripts to NOT fetch.
authored
155 DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
f7f687c @nvie Also add basic skeleton implementation for the gitflow-feature and gi…
authored
156 parse_args "$@"
c5fcc01 @nvie Do not quote variable assignments.
authored
157 BASE=${2:-$DEVELOP_BRANCH}
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
158 require_version_arg
010252a @nvie Added an optional <base> argument to all start subactions.
authored
159 require_base_is_on_develop
6d64d2c @nvie Add check to disallow creation of a new release/hotfix branch when there
authored
160 require_no_existing_release_branches
3d41255 @nvie Add checks for all the commands, to assure we're working in a clean a…
authored
161
00ccea6 @hollow refactor the whole thing
hollow authored
162 # sanity checks
7832d6e @nvie Better naming of common functions categorizing them into common,
authored
163 require_clean_working_tree
164 require_branch_absent "$BRANCH"
165 require_tag_absent "$VERSION_PREFIX$VERSION"
ca73caf @nvie Replaced all old-style flag variables by shFlags-style flag variables.
authored
166 if flag fetch; then
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
167 git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
2acfffd @nvie Make the 'to fetch or not to fetch' flag explicit in the other comman…
authored
168 fi
f6fcc4e - Removed quoting in has $SOME_BRANCH $(get_remote_branches), as the …
Konstantin Tjuterev authored
169 if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
de95e00 @nvie Change the default behaviour of all scripts to NOT fetch.
authored
170 require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
171 fi
3d41255 @nvie Add checks for all the commands, to assure we're working in a clean a…
authored
172
00ccea6 @hollow refactor the whole thing
hollow authored
173 # create branch
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
174 git_do checkout -b "$BRANCH" "$BASE"
696b9eb @nvie Functionally implement the creation/finishing of release branches.
authored
175
00ccea6 @hollow refactor the whole thing
hollow authored
176 echo
696b9eb @nvie Functionally implement the creation/finishing of release branches.
authored
177 echo "Summary of actions:"
010252a @nvie Added an optional <base> argument to all start subactions.
authored
178 echo "- A new branch '$BRANCH' was created, based on '$BASE'"
00ccea6 @hollow refactor the whole thing
hollow authored
179 echo "- You are now on branch '$BRANCH'"
180 echo
696b9eb @nvie Functionally implement the creation/finishing of release branches.
authored
181 echo "Follow-up actions:"
182 echo "- Bump the version number now!"
183 echo "- Start committing last-minute fixes in preparing your release"
184 echo "- When done, run:"
00ccea6 @hollow refactor the whole thing
hollow authored
185 echo
010252a @nvie Added an optional <base> argument to all start subactions.
authored
186 echo " git flow release finish '$VERSION'"
00ccea6 @hollow refactor the whole thing
hollow authored
187 echo
f7f687c @nvie Also add basic skeleton implementation for the gitflow-feature and gi…
authored
188 }
189
00ccea6 @hollow refactor the whole thing
hollow authored
190 cmd_finish() {
de95e00 @nvie Change the default behaviour of all scripts to NOT fetch.
authored
191 DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
1a2868b @nvie Add tag annotation and tag signing to both release and hotfix.
authored
192 DEFINE_boolean sign false "sign the release tag cryptographically" s
193 DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
194 DEFINE_string message "" "use the given tag message" m
2e9ab49 @sinbad Support reading the tag message from a file in release/hotfix finish
sinbad authored
195 DEFINE_string messagefile "" "use the contents of the given file as a tag message" f
ddba2df @nvie Fix spacing issues.
authored
196 DEFINE_boolean push false "push to $ORIGIN after performing finish" p
ddd9dfe @nvie Tidy up a bit.
authored
197 DEFINE_boolean keep false "keep branch after performing finish" k
ca8be52 @nvie Allow finishing release branches without creating a tag.
authored
198 DEFINE_boolean notag false "don't tag this release" n
0c4d0bf @nvie Cleanup (mostly whitespace issues).
authored
199 DEFINE_boolean squash false "squash release during merge" S
6809f0e @zerotao Added push option (-p) to hotfix and release
zerotao authored
200
f7f687c @nvie Also add basic skeleton implementation for the gitflow-feature and gi…
authored
201 parse_args "$@"
3c337fb @nvie Added -v (--verbose) flags to list subaction of all subcommands.
authored
202 require_version_arg
3d41255 @nvie Add checks for all the commands, to assure we're working in a clean a…
authored
203
1a2868b @nvie Add tag annotation and tag signing to both release and hotfix.
authored
204 # handle flags that imply other flags
205 if [ "$FLAGS_signingkey" != "" ]; then
206 FLAGS_sign=$FLAGS_TRUE
207 fi
208
00ccea6 @hollow refactor the whole thing
hollow authored
209 # sanity checks
7832d6e @nvie Better naming of common functions categorizing them into common,
authored
210 require_branch "$BRANCH"
211 require_clean_working_tree
ca73caf @nvie Replaced all old-style flag variables by shFlags-style flag variables.
authored
212 if flag fetch; then
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
213 git_do fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
1a2868b @nvie Add tag annotation and tag signing to both release and hotfix.
authored
214 die "Could not fetch $MASTER_BRANCH from $ORIGIN."
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
215 git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
1a2868b @nvie Add tag annotation and tag signing to both release and hotfix.
authored
216 die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
2acfffd @nvie Make the 'to fetch or not to fetch' flag explicit in the other comman…
authored
217 fi
f6fcc4e - Removed quoting in has $SOME_BRANCH $(get_remote_branches), as the …
Konstantin Tjuterev authored
218 if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
de95e00 @nvie Change the default behaviour of all scripts to NOT fetch.
authored
219 require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
220 fi
f6fcc4e - Removed quoting in has $SOME_BRANCH $(get_remote_branches), as the …
Konstantin Tjuterev authored
221 if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
de95e00 @nvie Change the default behaviour of all scripts to NOT fetch.
authored
222 require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
223 fi
3d41255 @nvie Add checks for all the commands, to assure we're working in a clean a…
authored
224
5fa4758 @nvie Made the finishing of release/hotfix branches fail-safe. When a
authored
225 # try to merge into master
226 # in case a previous attempt to finish this release branch has failed,
227 # but the merge into master was successful, we skip it now
7832d6e @nvie Better naming of common functions categorizing them into common,
authored
228 if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
229 git_do checkout "$MASTER_BRANCH" || \
5fa4758 @nvie Made the finishing of release/hotfix branches fail-safe. When a
authored
230 die "Could not check out $MASTER_BRANCH."
0c4d0bf @nvie Cleanup (mostly whitespace issues).
authored
231 if noflag squash; then
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
232 git_do merge --no-ff "$BRANCH" || \
0c4d0bf @nvie Cleanup (mostly whitespace issues).
authored
233 die "There were merge conflicts."
234 # TODO: What do we do now?
235 else
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
236 git_do merge --squash "$BRANCH" || \
0c4d0bf @nvie Cleanup (mostly whitespace issues).
authored
237 die "There were merge conflicts."
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
238 git_do commit
0c4d0bf @nvie Cleanup (mostly whitespace issues).
authored
239 fi
5fa4758 @nvie Made the finishing of release/hotfix branches fail-safe. When a
authored
240 fi
241
ca8be52 @nvie Allow finishing release branches without creating a tag.
authored
242 if noflag notag; then
243 # try to tag the release
244 # in case a previous attempt to finish this release branch has failed,
245 # but the tag was set successful, we skip it now
246 local tagname=$VERSION_PREFIX$VERSION
247 if ! git_tag_exists "$tagname"; then
248 local opts="-a"
249 flag sign && opts="$opts -s"
250 [ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
251 [ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
2e9ab49 @sinbad Support reading the tag message from a file in release/hotfix finish
sinbad authored
252 [ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
253 eval git_do tag $opts "$tagname" "$BRANCH" || \
ca8be52 @nvie Allow finishing release branches without creating a tag.
authored
254 die "Tagging failed. Please run finish again to retry."
255 fi
5fa4758 @nvie Made the finishing of release/hotfix branches fail-safe. When a
authored
256 fi
257
258 # try to merge into develop
259 # in case a previous attempt to finish this release branch has failed,
260 # but the merge into develop was successful, we skip it now
7832d6e @nvie Better naming of common functions categorizing them into common,
authored
261 if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
262 git_do checkout "$DEVELOP_BRANCH" || \
5fa4758 @nvie Made the finishing of release/hotfix branches fail-safe. When a
authored
263 die "Could not check out $DEVELOP_BRANCH."
d29e315 @nvie Annotated the code with some TODO-notes.
authored
264
265 # TODO: Actually, accounting for 'git describe' pays, so we should
266 # ideally git merge --no-ff $tagname here, instead!
0c4d0bf @nvie Cleanup (mostly whitespace issues).
authored
267 if noflag squash; then
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
268 git_do merge --no-ff "$BRANCH" || \
0c4d0bf @nvie Cleanup (mostly whitespace issues).
authored
269 die "There were merge conflicts."
270 # TODO: What do we do now?
271 else
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
272 git_do merge --squash "$BRANCH" || \
0c4d0bf @nvie Cleanup (mostly whitespace issues).
authored
273 die "There were merge conflicts."
274 # TODO: What do we do now?
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
275 git_do commit
0c4d0bf @nvie Cleanup (mostly whitespace issues).
authored
276 fi
5fa4758 @nvie Made the finishing of release/hotfix branches fail-safe. When a
authored
277 fi
00ccea6 @hollow refactor the whole thing
hollow authored
278
279 # delete branch
ddd9dfe @nvie Tidy up a bit.
authored
280 if noflag keep; then
46f9998 @nvie Don't stop the script when the release branch is the current branch.
authored
281 if [ "$BRANCH" = "$(git_current_branch)" ]; then
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
282 git_do checkout "$MASTER_BRANCH"
46f9998 @nvie Don't stop the script when the release branch is the current branch.
authored
283 fi
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
284 git_do branch -d "$BRANCH"
8fee0c2 Added -k option to keep (feature|hotfix|relase) branch when calling '…
Guillaume-Jean Herbiet authored
285 fi
696b9eb @nvie Functionally implement the creation/finishing of release branches.
authored
286
ddba2df @nvie Fix spacing issues.
authored
287 if flag push; then
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
288 git_do push "$ORIGIN" "$DEVELOP_BRANCH" || \
ddba2df @nvie Fix spacing issues.
authored
289 die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
290 git_do push "$ORIGIN" "$MASTER_BRANCH" || \
ddba2df @nvie Fix spacing issues.
authored
291 die "Could not push to $MASTER_BRANCH from $ORIGIN."
ca8be52 @nvie Allow finishing release branches without creating a tag.
authored
292 if noflag notag; then
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
293 git_do push --tags "$ORIGIN" || \
ca8be52 @nvie Allow finishing release branches without creating a tag.
authored
294 die "Could not push tags to $ORIGIN."
295 fi
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
296 git_do push "$ORIGIN" :"$BRANCH" || \
4c90d92 lets add automatic delete of the branch when the remote flag is set u…
Felipe Talavera authored
297 die "Could not delete the remote $BRANCH in $ORIGIN."
ddba2df @nvie Fix spacing issues.
authored
298 fi
696b9eb @nvie Functionally implement the creation/finishing of release branches.
authored
299
00ccea6 @hollow refactor the whole thing
hollow authored
300 echo
696b9eb @nvie Functionally implement the creation/finishing of release branches.
authored
301 echo "Summary of actions:"
350e715 @hollow make origin configurable
hollow authored
302 echo "- Latest objects have been fetched from '$ORIGIN'"
4a864fb @hollow make master and develop branch names configurable
hollow authored
303 echo "- Release branch has been merged into '$MASTER_BRANCH'"
ca8be52 @nvie Allow finishing release branches without creating a tag.
authored
304 if noflag notag; then
305 echo "- The release was tagged '$tagname'"
306 fi
4a864fb @hollow make master and develop branch names configurable
hollow authored
307 echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
8fee0c2 Added -k option to keep (feature|hotfix|relase) branch when calling '…
Guillaume-Jean Herbiet authored
308 if flag keep; then
ddd9dfe @nvie Tidy up a bit.
authored
309 echo "- Release branch '$BRANCH' is still available"
8fee0c2 Added -k option to keep (feature|hotfix|relase) branch when calling '…
Guillaume-Jean Herbiet authored
310 else
311 echo "- Release branch '$BRANCH' has been deleted"
312 fi
ddba2df @nvie Fix spacing issues.
authored
313 if flag push; then
314 echo "- '$DEVELOP_BRANCH', '$MASTER_BRANCH' and tags have been pushed to '$ORIGIN'"
4c90d92 lets add automatic delete of the branch when the remote flag is set u…
Felipe Talavera authored
315 echo "- Release branch '$BRANCH' in '$ORIGIN' has been deleted."
ddba2df @nvie Fix spacing issues.
authored
316 fi
00ccea6 @hollow refactor the whole thing
hollow authored
317 echo
f7f687c @nvie Also add basic skeleton implementation for the gitflow-feature and gi…
authored
318 }
fbcf4a0 add publish and track command to the release flow
Felipe Talavera authored
319
320 cmd_publish() {
321 parse_args "$@"
df706ac flow-release now checking if the version is set correctly
Felipe Talavera authored
322 require_version_arg
fbcf4a0 add publish and track command to the release flow
Felipe Talavera authored
323
324 # sanity checks
325 require_clean_working_tree
326 require_branch "$BRANCH"
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
327 git_do fetch -q "$ORIGIN"
fbcf4a0 add publish and track command to the release flow
Felipe Talavera authored
328 require_branch_absent "$ORIGIN/$BRANCH"
329
330 # create remote branch
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
331 git_do push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
332 git_do fetch -q "$ORIGIN"
fbcf4a0 add publish and track command to the release flow
Felipe Talavera authored
333
334 # configure remote tracking
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
335 git_do config "branch.$BRANCH.remote" "$ORIGIN"
336 git_do config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
337 git_do checkout "$BRANCH"
fbcf4a0 add publish and track command to the release flow
Felipe Talavera authored
338
339 echo
340 echo "Summary of actions:"
341 echo "- A new remote branch '$BRANCH' was created"
342 echo "- The local branch '$BRANCH' was configured to track the remote branch"
343 echo "- You are now on branch '$BRANCH'"
344 echo
345 }
346
347 cmd_track() {
348 parse_args "$@"
df706ac flow-release now checking if the version is set correctly
Felipe Talavera authored
349 require_version_arg
fbcf4a0 add publish and track command to the release flow
Felipe Talavera authored
350
351 # sanity checks
352 require_clean_working_tree
353 require_branch_absent "$BRANCH"
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
354 git_do fetch -q "$ORIGIN"
fbcf4a0 add publish and track command to the release flow
Felipe Talavera authored
355 require_branch "$ORIGIN/$BRANCH"
356
357 # create tracking branch
15aab26 @jeromebaum Use git_do where appropriate
jeromebaum authored
358 git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
fbcf4a0 add publish and track command to the release flow
Felipe Talavera authored
359
360 echo
361 echo "Summary of actions:"
362 echo "- A new remote tracking branch '$BRANCH' was created"
363 echo "- You are now on branch '$BRANCH'"
364 echo
365 }
Something went wrong with that request. Please try again.