Skip to content
This repository
Browse code

Be git-describe friendly.

This patch tags commits on the original (release/hotfix branch) instead
of tagging the merge commit on the master branch.  This keeps the
history git-describe friendly.  (For related discussions, see #49, #85,
  • Loading branch information...
commit aa93d2346f840e16a05c6546e1e22c1dddfbc997 2 parents afb191f + aec4818
Vincent Driessen authored
1  AUTHORS
@@ -19,5 +19,6 @@ Authors are (ordered by first commit date):
19 19 - Emre Berge Ergenekon
20 20 - Eric Holmes
21 21 - Vedang Manerikar
  22 +- Myke Hines
22 23
23 24 Portions derived from other open source works are clearly marked.
2  README.mdown
Source Rendered
@@ -138,7 +138,7 @@ Showing your appreciation
138 138 A few people already requested it, so now it's here: a Flattr button.
139 139
140 140 Of course, the best way to show your appreciation for the original
141   -[blog post](http://nvie.com/git-model) or the git-flow tool itself remains
  141 +[blog post](http://nvie.com/posts/a-successful-git-branching-model/) or the git-flow tool itself remains
142 142 contributing to the community. If you'd like to show your appreciation in
143 143 another way, however, consider Flattr'ing me:
144 144
1  contrib/msysgit-install.cmd
@@ -63,6 +63,7 @@ goto :End
63 63 :ChkGetopt
64 64 :: %1 is getopt.exe
65 65 if exist "%GIT_HOME%\bin\%1" goto :EOF
  66 +if exist "%USERPROFILE%\bin\%1" goto :EOF
66 67 if exist "%~f$PATH:1" goto :EOF
67 68 echo %GIT_HOME%\bin\%1 not found.>&2
68 69 echo You have to install this file manually. See the GitFlow README.
5 git-flow
@@ -109,7 +109,10 @@ main() {
109 109 fi
110 110
111 111 # run the specified action
112   - cmd_$SUBACTION "$@"
  112 + if [ $SUBACTION != "help" ]; then
  113 + init
  114 + fi
  115 + cmd_$SUBACTION "$@"
113 116 }
114 117
115 118 main "$@"
23 git-flow-feature
@@ -36,15 +36,17 @@
36 36 # policies, either expressed or implied, of Vincent Driessen.
37 37 #
38 38
39   -require_git_repo
40   -require_gitflow_initialized
41   -gitflow_load_settings
42   -PREFIX=$(git config --get gitflow.prefix.feature)
  39 +init() {
  40 + require_git_repo
  41 + require_gitflow_initialized
  42 + gitflow_load_settings
  43 + PREFIX=$(git config --get gitflow.prefix.feature)
  44 +}
43 45
44 46 usage() {
45 47 echo "usage: git flow feature [list] [-v]"
46 48 echo " git flow feature start [-F] <name> [<base>]"
47   - echo " git flow feature finish [-rFkD] [<name|nameprefix>]"
  49 + echo " git flow feature finish [-rFkDS] [<name|nameprefix>]"
48 50 echo " git flow feature publish <name>"
49 51 echo " git flow feature track <name>"
50 52 echo " git flow feature diff [<name|nameprefix>]"
@@ -232,6 +234,7 @@ cmd_finish() {
232 234 DEFINE_boolean rebase false "rebase instead of merge" r
233 235 DEFINE_boolean keep false "keep branch after performing finish" k
234 236 DEFINE_boolean force_delete false "force delete feature branch after finish" D
  237 + DEFINE_boolean squash false "squash feature during merge" S
235 238 parse_args "$@"
236 239 expand_nameprefix_arg_or_current
237 240
@@ -312,7 +315,13 @@ cmd_finish() {
312 315 if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
313 316 git merge --ff "$BRANCH"
314 317 else
315   - git merge --no-ff "$BRANCH"
  318 + if noflag squash; then
  319 + git merge --no-ff "$BRANCH"
  320 + else
  321 + git merge --squash "$BRANCH"
  322 + git commit
  323 + git merge "$BRANCH"
  324 + fi
316 325 fi
317 326
318 327 if [ $? -ne 0 ]; then
@@ -507,7 +516,7 @@ cmd_pull() {
507 516 exit 1
508 517 fi
509 518 else
510   - it pull -q "$REMOTE" "$BRANCH" || die "Failed to pull from remote '$REMOTE'."
  519 + git pull -q "$REMOTE" "$BRANCH" || die "Failed to pull from remote '$REMOTE'."
511 520 fi
512 521
513 522 echo "Pulled $REMOTE's changes into $BRANCH."
35 git-flow-hotfix
@@ -36,17 +36,20 @@
36 36 # policies, either expressed or implied, of Vincent Driessen.
37 37 #
38 38
39   -require_git_repo
40   -require_gitflow_initialized
41   -gitflow_load_settings
42   -VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
43   -PREFIX=$(git config --get gitflow.prefix.hotfix)
  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.hotfix)
  45 +}
44 46
45 47 usage() {
46 48 echo "usage: git flow hotfix [list] [-v]"
47 49 echo " git flow hotfix start [-F] <version> [<base>]"
48 50 echo " git flow hotfix finish [-Fsumpk] <version>"
49 51 echo " git flow hotfix publish <version>"
  52 + echo " git flow hotfix track <version>"
50 53 }
51 54
52 55 cmd_default() {
@@ -216,11 +219,32 @@ cmd_publish() {
216 219 echo
217 220 }
218 221
  222 +cmd_track() {
  223 + parse_args "$@"
  224 + require_version_arg
  225 +
  226 + # sanity checks
  227 + require_clean_working_tree
  228 + require_branch_absent "$BRANCH"
  229 + git fetch -q "$ORIGIN"
  230 + require_branch "$ORIGIN/$BRANCH"
  231 +
  232 + # create tracking branch
  233 + git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
  234 +
  235 + echo
  236 + echo "Summary of actions:"
  237 + echo "- A new remote tracking branch '$BRANCH' was created"
  238 + echo "- You are now on branch '$BRANCH'"
  239 + echo
  240 +}
  241 +
219 242 cmd_finish() {
220 243 DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
221 244 DEFINE_boolean sign false "sign the release tag cryptographically" s
222 245 DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
223 246 DEFINE_string message "" "use the given tag message" m
  247 + DEFINE_string messagefile "" "use the contents of the given file as tag message" f
224 248 DEFINE_boolean push false "push to $ORIGIN after performing finish" p
225 249 DEFINE_boolean keep false "keep branch after performing finish" k
226 250 DEFINE_boolean notag false "don't tag this release" n
@@ -269,6 +293,7 @@ cmd_finish() {
269 293 flag sign && opts="$opts -s"
270 294 [ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
271 295 [ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
  296 + [ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
272 297 eval git tag $opts "$VERSION_PREFIX$VERSION" "$BRANCH" || \
273 298 die "Tagging failed. Please run finish again to retry."
274 299 fi
8 git-flow-init
@@ -153,11 +153,17 @@ cmd_default() {
153 153 default_suggestion=
154 154 for guess in $(git config --get gitflow.branch.develop) \
155 155 'develop' 'int' 'integration' 'master'; do
156   - if git_local_branch_exists "$guess"; then
  156 + if git_local_branch_exists "$guess" && [ "$guess" != "$master_branch" ]; then
157 157 default_suggestion="$guess"
158 158 break
159 159 fi
160 160 done
  161 +
  162 + if [ -z $default_suggestion ]; then
  163 + should_check_existence=NO
  164 + default_suggestion=$(git config --get gitflow.branch.develop || echo develop)
  165 + fi
  166 +
161 167 fi
162 168
163 169 printf "Branch name for \"next release\" development: [$default_suggestion] "
42 git-flow-release
@@ -36,16 +36,18 @@
36 36 # policies, either expressed or implied, of Vincent Driessen.
37 37 #
38 38
39   -require_git_repo
40   -require_gitflow_initialized
41   -gitflow_load_settings
42   -VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
43   -PREFIX=$(git config --get gitflow.prefix.release)
  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 +}
44 46
45 47 usage() {
46 48 echo "usage: git flow release [list] [-v]"
47 49 echo " git flow release start [-F] <version> [<base>]"
48   - echo " git flow release finish [-Fsumpk] <version>"
  50 + echo " git flow release finish [-FsumpkS] <version>"
49 51 echo " git flow release publish <name>"
50 52 echo " git flow release track <name>"
51 53 }
@@ -190,9 +192,11 @@ cmd_finish() {
190 192 DEFINE_boolean sign false "sign the release tag cryptographically" s
191 193 DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
192 194 DEFINE_string message "" "use the given tag message" m
  195 + DEFINE_string messagefile "" "use the contents of the given file as a tag message" f
193 196 DEFINE_boolean push false "push to $ORIGIN after performing finish" p
194 197 DEFINE_boolean keep false "keep branch after performing finish" k
195 198 DEFINE_boolean notag false "don't tag this release" n
  199 + DEFINE_boolean squash false "squash release during merge" S
196 200
197 201 parse_args "$@"
198 202 require_version_arg
@@ -224,9 +228,15 @@ cmd_finish() {
224 228 if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
225 229 git checkout "$MASTER_BRANCH" || \
226 230 die "Could not check out $MASTER_BRANCH."
227   - git merge --no-ff "$BRANCH" || \
228   - die "There were merge conflicts."
229   - # TODO: What do we do now?
  231 + if noflag squash; then
  232 + git merge --no-ff "$BRANCH" || \
  233 + die "There were merge conflicts."
  234 + # TODO: What do we do now?
  235 + else
  236 + git merge --squash "$BRANCH" || \
  237 + die "There were merge conflicts."
  238 + git commit
  239 + fi
230 240 fi
231 241
232 242 if noflag notag; then
@@ -239,6 +249,7 @@ cmd_finish() {
239 249 flag sign && opts="$opts -s"
240 250 [ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
241 251 [ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
  252 + [ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
242 253 eval git tag $opts "$tagname" "$BRANCH" || \
243 254 die "Tagging failed. Please run finish again to retry."
244 255 fi
@@ -253,9 +264,16 @@ cmd_finish() {
253 264
254 265 # TODO: Actually, accounting for 'git describe' pays, so we should
255 266 # ideally git merge --no-ff $tagname here, instead!
256   - git merge --no-ff "$BRANCH" || \
257   - die "There were merge conflicts."
258   - # TODO: What do we do now?
  267 + if noflag squash; then
  268 + git merge --no-ff "$BRANCH" || \
  269 + die "There were merge conflicts."
  270 + # TODO: What do we do now?
  271 + else
  272 + git merge --squash "$BRANCH" || \
  273 + die "There were merge conflicts."
  274 + # TODO: What do we do now?
  275 + git commit
  276 + fi
259 277 fi
260 278
261 279 # delete branch
12 git-flow-support
@@ -36,11 +36,13 @@
36 36 # policies, either expressed or implied, of Vincent Driessen.
37 37 #
38 38
39   -require_git_repo
40   -require_gitflow_initialized
41   -gitflow_load_settings
42   -VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
43   -PREFIX=$(git config --get gitflow.prefix.support)
  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.support)
  45 +}
44 46
45 47 warn "note: The support subcommand is still very EXPERIMENTAL!"
46 48 warn "note: DO NOT use it in a production situation."

0 comments on commit aa93d23

Please sign in to comment.
Something went wrong with that request. Please try again.