├── .editorconfig ├── .gitattributes ├── .mailmap ├── AUTHORS ├── CHANGELOG.md ├── LICENSE ├── Makefile ├── README.md ├── contrib ├── gitflow-installer.sh └── msysgit-install.cmd ├── git-flow ├── git-flow-bugfix ├── git-flow-config ├── git-flow-feature ├── git-flow-hotfix ├── git-flow-init ├── git-flow-log ├── git-flow-release ├── git-flow-support ├── git-flow-version ├── gitflow-common ├── gitflow-shFlags └── hooks ├── filter-flow-hotfix-finish-tag-message ├── filter-flow-hotfix-start-version ├── filter-flow-release-branch-tag-message ├── filter-flow-release-finish-tag-message ├── filter-flow-release-start-version ├── post-flow-bugfix-delete ├── post-flow-bugfix-finish ├── post-flow-bugfix-publish ├── post-flow-bugfix-pull ├── post-flow-bugfix-start ├── post-flow-bugfix-track ├── post-flow-feature-delete ├── post-flow-feature-finish ├── post-flow-feature-publish ├── post-flow-feature-pull ├── post-flow-feature-start ├── post-flow-feature-track ├── post-flow-hotfix-delete ├── post-flow-hotfix-finish ├── post-flow-hotfix-publish ├── post-flow-hotfix-start ├── post-flow-release-branch ├── post-flow-release-delete ├── post-flow-release-finish ├── post-flow-release-publish ├── post-flow-release-start ├── post-flow-release-track ├── pre-flow-feature-delete ├── pre-flow-feature-finish ├── pre-flow-feature-publish ├── pre-flow-feature-pull ├── pre-flow-feature-start ├── pre-flow-feature-track ├── pre-flow-hotfix-delete ├── pre-flow-hotfix-finish ├── pre-flow-hotfix-publish ├── pre-flow-hotfix-start ├── pre-flow-release-branch ├── pre-flow-release-delete ├── pre-flow-release-finish ├── pre-flow-release-publish ├── pre-flow-release-start └── pre-flow-release-track /.editorconfig: -------------------------------------------------------------------------------- 1 | # This is the top-most .editorconfig file; do not search in parent directories. 2 | root = true 3 | 4 | [*] 5 | end_of_line = LF 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [Changes.mdown] 10 | indent_style = space 11 | indent_size = 2 12 | 13 | [*.mdown] 14 | trim_trailing_whitespace = false 15 | 16 | [{Makefile, makefile, GNUmakefile}] 17 | indent_style = tab 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.awk text eol=lf 4 | *.sed text eol=lf 5 | *.sh text eol=lf 6 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | # 2 | # This list is used by git-shortlog to fix a few botched names in the 3 | # git-flow repo, either because the author's full name was messed up and/or 4 | # not always written the same way, making contributions from the same person 5 | # appearing not to be so. 6 | # 7 | 8 | Eric Holmes 9 | Eric J. Holmes 10 | Stefan Näwe 11 | Stefan Näwe 12 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | git-flow AVH Authors 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals. For exact contribution history, see the revision history 5 | and logs, available at 6 | http://github.com/petervanderdoes/gitflow. 7 | 8 | 9 | Peter van der Does 10 | Vincent Driessen 11 | Daniel Dehennin 12 | Benedikt Böhm 13 | Leonid Komarovsky 14 | Felipe Talavera 15 | Randy Merrill 16 | Kevin Woo 17 | Daniel Truemper 18 | Eric J. Holmes 19 | Fred Condo 20 | Alexandre Dutra 21 | Andreas Heiduk 22 | Ben Loveridge 23 | Florian Gamböck 24 | Gergely Nagy 25 | JP Toto 26 | Kiall Mac Innes 27 | Lorin Hochstein 28 | Olivier Mengué 29 | Oppodelldog 30 | Stefan Näwe 31 | Adam Gibbins 32 | Alexander Groß 33 | Alexander Norström 34 | Alexander Zeitler 35 | Brian St. Pierre 36 | Cararus Eugeniu 37 | Chad Walker 38 | Craig Fowler 39 | Emre Berge Ergenekon 40 | Gregor A. Cieslak 41 | Gruen Christian-Rolf (Kiki) 42 | Guillaume-Jean Herbiet 43 | James Moran 44 | Jannis Leidel 45 | Jason L. Shiffer 46 | Jean Jordaan 47 | Jelte Fennema 48 | Joe Ebmeier 49 | John Sivak 50 | Jon Bernard 51 | Joseph A. Levin 52 | Joshua P. Tilles 53 | Juan Rial 54 | Justin Penney 55 | Konstantin Tjuterev 56 | Kridsada Thanabulpong 57 | Leonardo Giordani 58 | Luis Fernando Gomes @luiscoms 59 | Mark Borcherding 60 | Mark Derricutt 61 | Mateusz Kaczmarek 62 | Matias Hernan Lauriti 63 | Mayerber Carvalho Neto 64 | Nowell Strite 65 | Opher Vishnia 66 | Peter Schröder 67 | Pokey Rule 68 | Stefan Schüßler 69 | Steffen Jaeckel 70 | Steve Mao 71 | Steve Streeting 72 | Tacit Sawk 73 | Vedang Manerikar 74 | Zheeeng 75 | eddie cianci 76 | gmallard 77 | gpongelli 78 | raybec 79 | 80 | 81 | Portions of the project are derived from other open source works are clearly 82 | marked. 83 | 84 | This file is auto generated, any changes will be lost. 85 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | [petervanderdoes]: https://github.com/petervanderdoes "Peter van der Does on github" 2 | [adamrodger]: https://github.com/adamrodger 3 | [adutra]: https://github.com/adutra 4 | [aleno]: https://github.com/aleno 5 | [algernon]: https://github.com/algernon 6 | [asheiduk]: https://github.com/asheiduk 7 | [baby-gnu]: https://github.com/baby-gnu 8 | [bloomonkey]: https://github.com/bloomonkey 9 | [bloveridge]: https://github.com/bloveridge "Ben Loveridge on github" 10 | [craigfowler]: https://github.com/craigfowler 11 | [cyberbob]: https://github.com/cyberbob 12 | [floga]: https://github.com/FloGa 13 | [gene-pavlovsky]: https://github.com/gene-pavlovsky 14 | [gpongelli]: https://github.com/gpongelli 15 | [gvangool]: https://github.com/gvangool 16 | [havvg]: https://github.com/havvg 17 | [jebmeier]: https://github.com/jebmeier 18 | [jeromebaum]: https://github.com/jeromebaum 19 | [jpenney78]: https://github.com/jpenney78 20 | [jsivak]: https://github.com/jsivak 21 | [kperi]: https://github.com/kperi 22 | [lrkwz]: https://github.com/lrkwz 23 | [mallamanis]: https://github.com/mallamanis 24 | [mayerc-MSFT]: https://github.com/mayerc-MSFT 25 | [memleak]: https://github.com/memleak/ 26 | [merelyapseudonym]: https://github.com/MerelyAPseudonym 27 | [mykehsd]: https://github.com/mykehsd 28 | [OpherV]: https://github.com/OpherV 29 | [Oppodelldog]: https://github.com/Oppodelldog 30 | [pokey]: https://github.com/pokey 31 | [pcragone]: https://github.com/pcragone 32 | [Shoozza]: https://github.com/Shoozza 33 | [shpoont]: https://github.com/shpoont 34 | [silasfn]: https://github.com/silasfn 35 | [sinbad]: https://github.com/sinbad 36 | [sirn]: https://github.com/sirn 37 | [stevemao]: https://github.com/stevemao 38 | [Tiscs]: https://github.com/Tiscs 39 | [zheeeng]: https://github.com/zheeeng 40 | 41 | # Changelog 42 | 43 | #### 1.12.4-dev0 44 | * Preparation for next release 45 | 46 | #### 1.12.3 47 | * Explicitly get the default values from the system and global config. 48 | 49 | #### 1.12.2 50 | * Missing parentheses (Thanks [Tiscs Sun][Tiscs] ) 51 | 52 | #### 1.12.1 53 | [Peter van der Does][petervanderdoes] 54 | * When using the `-d` flag during `init` the defaults are empty. Identified by [Adam Rodger][adamrodger] 55 | 56 | #### 1.12.0 57 | [Peter van der Does][petervanderdoes] 58 | * Bugfix: Remove inconsistency when pre_hook fails (Thanks [Gabriele Pongelli][gpongelli]) 59 | * Fix indentation in README.md (Thanks [Shoozza][Shoozza]) 60 | 61 | 62 | [Andreas Heiduk][asheiduk] 63 | * Bugfix: Unexpected operator. 64 | 65 | [zheeeng][zheeeng] 66 | * Enhancement: Review your commits more easier on figuring out what this feature/bugfix added exactly. 67 | 68 | [Oppodelldog][Oppodelldog] 69 | * Enhancement: Allows to install a specific version of git-flow when using the `gitflow-installer.sh` script 70 | 71 | [mayerc][mayerc-MSFT] 72 | * Enhancement: Add option that will not allow the a merge back into the develop branch. 73 | 74 | [Steve Mao][stevemao] 75 | * Fix: Standarize the README markdown. 76 | 77 | [Gabriele Pongelli][gpongelli] 78 | * Enhancement: Also use core.hooksPath for suggestion for the hook path during initialization. 79 | 80 | [Gene Pavlovsky][gene-pavlovsky] 81 | * Enhancement: Add .gitattributes to enforce Unix line endings for certain files. 82 | 83 | [Luca Orlandi][lrkwz] 84 | * Reflect shared hotfix usage in readme. 85 | 86 | [Tiscs Sun][Tiscs] 87 | * Enhancement: Add parameters to set names for the branches during the init command. 88 | 89 | [Silas Palmer][silasfn] 90 | * Fix: Comparability change for git for windows 91 | 92 | [Pokey Rule][pokey] 93 | * Perform git push before deleting branch 94 | 95 | #### 1.11.0 96 | [Peter van der Does][petervanderdoes] 97 | * Bugfix: Problems when using fetch.prune 98 | * Bugfix: Errors when initializing git flow and useconfigonly is set but the name and/or email has not been set. 99 | * Bugfix: Report summary on finish is incorrect. 100 | * Missing push on bugfix finish 101 | * Allow a dirty tree when starting a hotfix/support/release branch if set to do so. 102 | If the config `gitflow.allowdirty` is set to `true`, allow starting from a dirty tree. 103 | * Bugfix: Error when trying to delete a non-existent remote branch 104 | * Feature: Add rename command to bugfix/hotfix/feature 105 | 106 | [Andreas Heiduk][asheiduk] 107 | * git flow * rebase now supports rebase.autoStash flag 108 | git rebase can automatically cleanup the working tree. Therefore skip the test when and where appropriate. 109 | 110 | #### 1.10.2 111 | [Peter van der Does][petervanderdoes] 112 | * Bugfix: Error finishing a release. 113 | 114 | #### 1.10.1 115 | [Peter van der Does][petervanderdoes] 116 | * Bugfix: flag short name (p) already defined 117 | 118 | #### 1.10.0 119 | [Peter van der Does][petervanderdoes] 120 | * Update github links. 121 | * Add explanation of AVH. 122 | * Add ability when finishing a release to push or not push the branches and/or tag involved. 123 | * The finishing of a release branch based on a branch other than develop fails with errors. 124 | * Add --push flag for feature finish. This gives the ability to push the base branch after the finish. 125 | * When finishing a release have the ability to fast-forward the master branch, if possible. 126 | This is controlled by the flag --ff-master. 127 | * Add new flag -T, --tagname to override the tag name when finishing a release or hotfix. 128 | * Allow multiple hotfix branches by setting the config allowmultihotfix to true. 129 | The command to set it is 130 | 131 | [Kridsada Thanabulpong][sirn] 132 | * Fix infinite loop during Darwin link resolving. 133 | 134 | [Justin Penney][jpenney78] 135 | * Add detection for BusyBox getopt. 136 | 137 | #### 1.9.1 138 | [Peter van der Does][petervanderdoes] 139 | * Bugfix: git-flow directories are not set correctly 140 | 141 | #### 1.9.0 142 | [Peter van der Does][petervanderdoes] 143 | * Add bugfix command. 144 | * Repositories with spaces in path cause the pre * post hook to fail. 145 | * Error using git flow log. 146 | * Using defaults with init fails with existing repository. 147 | * Allow multiple hotfix branches. 148 | By setting the config gitflow.multi-hotfix to true, you can have multiple 149 | hotfix branches. Example: git config --set gitflow.multi-hotfix true 150 | * Can't delete branch if the base branch is not the develop branch. 151 | * Add squash and squash-info flag to hotfix finish. 152 | * Problem when the repository directory has multiple spaces. 153 | 154 | [Gergely Nagy][algernon] 155 | * Remove bash code. 156 | 157 | [Joe Ebmeier][jebmeier] 158 | * Fix issue in case CDPATH is being used. 159 | In the case of CDPATH being used, it is possible DOT_GIT_DIR variable 160 | is incorrect. 161 | 162 | [Alexander Norström][aleno] 163 | * Fix issue when a prefix is chosen that doesn't end in a slash 164 | 165 | #### 1.8.0 166 | [Peter van der Does][petervanderdoes] 167 | * Add rebase action to release, hotfix and support. 168 | * Shortcut for rebase commands. 169 | Introduce the following new command: 170 | * git flow rebase 171 | 172 | This command will perform the action on the branch that's currently active. 173 | * Use the base branch when doing a git flow feature diff. 174 | When doing a diff on the feature branch use the base branch which this 175 | feature originated from. It will show the committed changes. 176 | * Problem when certain variables are set before executing git-flow. 177 | When certain variables are set in the shell environment it causes problems. 178 | * Warning for commands to be deprecated. 179 | The command "feature checkout/co" will be deprecated per version 2.0.0 180 | The command "feature pull" will be deprecated per version 2.0.0 181 | * Using fetch flag fails sometimes. 182 | * Hooks and filters are not executed when you are in a subdirectory of the 183 | repository and the hooks directory is set to the suggested value during 184 | initialization. 185 | 186 | [Craig Fowler][craigfowler] 187 | * 'export' fails in 'gitflow_load_settings()' 188 | 189 | [Toni Uebernickel][havvg] 190 | * Add log command 191 | 192 | #### 1.7.0 193 | [Peter van der Does][petervanderdoes] 194 | * Refactor the gitflow override flag functions. 195 | * Shortcut for finish, delete, and publish commands. 196 | Introduce the following new commands: 197 | * git flow finish 198 | * git flow delete 199 | * git flow publish 200 | 201 | These commands will perform the action on the branch that's currently active. 202 | * No branch is needed for the following function: 203 | * git flow feature publish/finish/delete 204 | * git flow release publish/finish/delete 205 | * git flow hotfix publish/finish/delete 206 | 207 | * Remove base configuration when deleting a feature/hotfix/release branch. 208 | * Help text for certain commands is wrong. 209 | * Bugfix: Invalid function call. 210 | * Bugfix: No make installer fails 211 | * Support branches are no longer marked as experimental. 212 | 213 | [John Sivak][jsivak] 214 | * Fix sanity check for release track command. 215 | 216 | [Opher Vishnia][OpherV] 217 | * Fix feature pull. 218 | The pull request fails when there's no local branch with the same name as the 219 | remote branch. 220 | 221 | [Leonid Komarovsky][shpoont] 222 | * Option for global hooks and filters directory. 223 | This is only for hooks and filters related to git-flow, not the standard git 224 | hooks. 225 | 226 | #### 1.6.1 227 | [Peter van der Does][petervanderdoes] 228 | * Migration of gitflow_config fails for posix sh. 229 | * Error messages when .gitflow_export doesn't exists. 230 | 231 | #### 1.6.0 232 | [Peter van der Does][petervanderdoes] 233 | * Add ability to short-circuit the version filters. 234 | An exit of 127 will short-circuit the process. 235 | * Output when finishing a branch is wrong. 236 | 237 | [Mateusz Kaczmarek][cyberbob] 238 | * Fix sanity check for feature track command. 239 | 240 | [Leonid Komarovsky][shpoont] 241 | * Move configuration from ~/.gitflow_export to default git config. 242 | * Move base configuration from it's own configuration file to the default local git config file. 243 | * Improve formatting of the help. 244 | 245 | #### 1.5.3 246 | [Peter van der Does][petervanderdoes] 247 | * Bugfix: Error about deleting branch when using squash option. 248 | When using the squash option for release/feature finish, the release/feature 249 | branch is not deleted. 250 | 251 | #### 1.5.2 252 | [Peter van der Does][petervanderdoes] 253 | * Add filter for tag message . 254 | If a tag message is given, the message can be modified using the filters: 255 | - filter-flow-hotfix-finish-tag-message 256 | - filter-flow-release-finish-tag-message 257 | - filter-flow-release-branch-tag-message 258 | * Bugfix: Typo in documentation. 259 | 260 | [Florian Gamböck][floga] 261 | * Bugfix: Fix variable name in hotfix 262 | 263 | [Leonid Komarovsky][shpoont] 264 | * git flow rebase will rebase against its base branch instead of develop. 265 | * Add flag --preserve-merges for feature rebase or feature finish. 266 | 267 | #### 1.5.1 268 | [Peter van der Does][petervanderdoes] 269 | * Fix some of the flag override environment variable names. 270 | 271 | [Joshua P. Tilles][merelyapseudonym] 272 | * Add default flag for flag showcommands. 273 | 274 | [Florian Gamböck][floga] 275 | * Bugfix: Fix variable non-zero test 276 | Due to missing quotation marks, the -n test won't work properly, leading to 277 | always returning true and overriding variables with nothing. 278 | 279 | 280 | #### 1.5.0 281 | [Peter van der Does][petervanderdoes] 282 | * Add the ability to set defaults for flag. 283 | You can now set defaults for flags by setting environment variables. 284 | * Add flag no-ff to feature finish. 285 | This gives the ability to never fast-forward a merge, even when it's only 286 | one commit. 287 | * Bugfix: Error in a long flag name for release finish 288 | * Function in gitflow-shFlags refactored to make it faster. 289 | * Add flag --squash-info to release/feature finish. 290 | When you use the flag --squash while finishing a release or feature branch, 291 | the logs don't make it clear which branch you merged. The new flag will add 292 | an extra comment to the commit message, stating which branch was used for the 293 | merge. 294 | * Bugfix: The contrib gitflow-installer.sh shows wrong installation instructions. 295 | 296 | #### 1.4.2 297 | * Bugfix: Update from upstream for shFlags 298 | 299 | #### 1.4.1 300 | * Bugfix: Missed quotation mark 301 | 302 | #### 1.4.0 303 | [Peter van der Does][petervanderdoes] 304 | * Remember the base. 305 | With the commands feature/hotfix/release start you can give a base from which 306 | the new branch will be created. Upon finishing this branch it will 307 | automatically merge the branch back into the base as given during the start. 308 | If no base is given the normal functionality will be followed. 309 | With the hotfix and release, if a base is given and it's not the 310 | DEVELOP_BRANCH, the branch will *NOT* be merged back into the $DEVELOP_BRANCH 311 | upon finishing this branch. 312 | * New config command. 313 | git flow config base. This can be used to set and get the base for 314 | feature/hotfix/release branches so it can be used when finishing these 315 | branches. 316 | * Get the correct working directory when the git-flow file is a symbolic link. 317 | * Don't check/compare hotfix and base branch when branch is merged already. 318 | * Remove export POSIXLY_CORRECT. 319 | Setting this environment variable can mess things up when git-flow is used in 320 | combination with other shell scripts. 321 | * Update gitflow-shFlags from upstream. 322 | Besides other improvements this update eliminates the use of external system 323 | calls on a majority of systems which in theory leads to a speed increase of 324 | about 20%. 325 | * Use GNU getopt on BSD systems. 326 | BSD getopt doesn't support long options in commands but the GNU getopt does. 327 | 328 | [Alexandre Dutra][adutra] 329 | * Git refuses to delete local branch with "-d" if it is tracking a remote one. 330 | * Can't always delete current release/hotfix local branch on finish 331 | Situation can occur you are on the local branch the script wants to delete, if 332 | you are you can't delete that branch. We'll switch to the base branch when 333 | you are deleting the branch you currently are on. 334 | 335 | #### 1.3.1 336 | * Bugix: git flow config list results in error. 337 | 338 | #### 1.3.0 339 | [Peter van der Does][petervanderdoes] 340 | * Make name in feature publish optional. 341 | Instead of always having to add the branch when doing a git flow feature 342 | publish, the name should be optional. 343 | When a name isn't given, the current branch, if it's a feature branch, 344 | will be published. 345 | * Add option to select configuration file usage 346 | As with the regular git config, git flow init now has the 347 | option --file, --global, --system and --local. --local is default. 348 | * Add a new command. 349 | New command git flow config is added. 350 | With this command you can see your current git flow configuration and you 351 | can also set the options. 352 | * Environment settings for git-flow only. 353 | With git you can set environment variables to change behavior, like 354 | GIT_MERGE_AUTOEDIT for example. 355 | You can add these exports to the file ~/.gitflow_export if you only want 356 | to set the environment variable for git-flow. 357 | * Bugfix: Missing command hotfix track. 358 | The command git flow hotfix track is not implemented. 359 | 360 | #### 1.2.1 361 | [Peter van der Does][petervanderdoes] 362 | * Bugfix: The --showcommands was on by default. It should be off by default. 363 | 364 | #### 1.2.0 365 | [Peter van der Does][petervanderdoes] 366 | * Improve the help output of the commands. 367 | * Fix problem with init function on BSD systems. 368 | * Add initialize function to git flow version. 369 | * Add parameter --showcommands to all commands. 370 | This will show the git commands performed while executing the command. Thanks 371 | to [Jerome Baum][jeromebaum] for the original implementation. 372 | 373 | [Daniel Dehennin][baby-gnu] 374 | * Display where user is on finish. 375 | Some commands did not display the branch you are on after the command 376 | finished. 377 | * When finishing a hotfix/release and it's to be tagged, the tag must not exist. 378 | 379 | #### 1.1.0 380 | [Peter van der Does][petervanderdoes] 381 | * Bugfix: feature finish does double merge when using squash option. 382 | 383 | * Add the ability to keep/delete local/remote branches on finish. 384 | When finishing a release/hotfix/feature you now can keep/delete the 385 | local/remote release/hotfix/feature branch. 386 | 387 | * New command: git flow release branch 388 | With this command you can directly release a given branch. There is no need 389 | to start a new release and finish it. You can not use this command on the 390 | git-flow branches feature/hotfix/release/support. 391 | 392 | * Do not display object fetch summary if flag was not set. 393 | Thanks to [Daniel Dehennin][baby-gnu]. 394 | 395 | * Bugfix: Checking if branch exists will fail for remote branches. 396 | 397 | * Make die output consistent for each die case. 398 | 399 | * Bugfix: When running git flow init an error message pops up. 400 | 401 | * Show correct help for subactions. 402 | When requesting help with -h for the subactions, the help would show the 403 | incorrect command line. 404 | 405 | * Support reading the tag message from a file in release/hotfix finish. 406 | Add the option -f,--messagefile to release and hotfix finish. Thanks to 407 | [Steve Streeting][sinbad] for the original coding. 408 | 409 | * Bugfix: git_current_branch fails for git prior 1.7.10. 410 | git symbolic-ref does not have the --short option prior to version 1.7.10. 411 | Bug found by [Daniel Dehennin][baby-gnu]. 412 | 413 | * Clean up code. 414 | Remove all porcelain commands. 415 | Refactor code. 416 | 417 | * Improve the back-merge functionality. 418 | Adds an command line option (-b), which the user can utilize if the user 419 | doesn't want to back-merge but rather merge the release branch into 420 | develop. 421 | 422 | * Add the sub-action delete to sub-commands feature, release and hotfix. 423 | The sub-commands feature, release and hotfix now have a new sub-action, 424 | delete. With that action you can delete the branches, locally and remote. 425 | The action has two options, -f and -r. With -f you can force the deletion, 426 | even when the to be deleted branch was not merged yet. With -r the remote 427 | branch will also be deleted. 428 | 429 | [Daniel Dehennin][baby-gnu] 430 | * Bugfix: release/feature/hotfix start -F fails. 431 | Usage of positional parameters requires to eval ${FLAGS_ARGV}. The "eval set" 432 | in function call does not propagate to the caller. 433 | 434 | * Accept tags as base for hotfix/release/support start. 435 | Commit pointed by tags are reachable with ^0\[1\]. 436 | 437 | * Check for parameter existence for branch and tag existence helpers. 438 | 439 | * Do not finish hotfixes if they have no commits. 440 | A hotfix branch must have some commits and be ahead of master. 441 | 442 | * Bugfix: When running git flow version an error message pops up. 443 | 444 | * Reorder fetch and sanity checks. 445 | When a user requests a fetch for git flow {feature|hotfix|support} start, do 446 | this before some sanity checks to avoid any conflict in branch names 447 | and/or version. 448 | 449 | * Fix flag test in cmd_delete(). 450 | 451 | [Myke Hines][mykehsd] 452 | * Feature and Release squashing options. 453 | This allows a -S option to both feature and releasing finishing actions so 454 | that developers can squash commits into one large one. 455 | 456 | [Peter Ragone][pcragone] 457 | * Add init to git-flow-{feature,release,hotfix,support}. 458 | Fixes the relatively minor issue where 'git flow subcommand help' 459 | gives "Not a gitflow-enabled repo yet". 460 | 461 | * Special thanks to the following individual: 462 | [Gert Van Gool][gvangool] 463 | 464 | #### 1.0-avh 465 | [Peter van der Does][petervanderdoes] 466 | 467 | * Remove trailing whitespace. 468 | 469 | * Updated from latest develop branch from nvie. 470 | Some features were still missing. 471 | 472 | * Remove the submodule shFlags. 473 | Instead of the submodule we'll just use the file. 474 | 475 | * When finishing a release or hotfix, use tag for back-merging if available. 476 | When a release or hotfix branch is tagged, the tag is never merged into the 477 | develop branch, it is preferable to have the tag in the develop branch as 478 | well, for use with git describe for example. 479 | 480 | * Update license info. 481 | 482 | * Bugfix: Typo when pulling existing feature from remote.Thanks to [John Harrison][bloomonkey], [Miltos][mallamanis], [Kostas][kperi] and [memleak][memleak]. 483 | 484 | * Wrong variable names in the bare-bones. 485 | The wrong variable name is set, this can lead to confusing on what's 486 | passed to the script, 487 | 488 | [Steve Streeting][sinbad] 489 | * Fixes the suggested name for the integration branch. 490 | When git init -d is executed on a repo with multiple branches, the 491 | suggested name for the integration branch could possibly be the same name 492 | that was already selected for the production release branch. 493 | If no suggested name is determined the suggested name remains empty which 494 | leads to all sorts of other problems. 495 | 496 | #### 0.4.2-avh1 497 | [Peter van der Does][petervanderdoes] 498 | 499 | * Start of the git flow AVH release. 500 | 501 | * Adds support for the version filter in the commands `git flow release start` 502 | and `git flow hotfix start` 503 | 504 | * Adds support for hooks in various commands. 505 | 506 | [Ben Loveridge][bloveridge] 507 | 508 | * Fix usage of shFlags on FreeBSD 509 | 510 | #### 0.4.2 511 | Release date: not yet 512 | 513 | * `git flow init` now detects situations where origin already has gitflow 514 | branches set up, and behaves accordingly (thanks Emre Berge Ergenekon). 515 | 516 | * `git flow feature finish` can now be called without a feature branch 517 | name(prefix) argument and will finish the current branch, if on any. 518 | 519 | * `git flow feature pull` now has a `-r` flag, to support `pull --rebase` 520 | semantics (thanks Vedang Manerikar). 521 | 522 | * Various minor bug fixes related to internal argument passing. 523 | 524 | * Improved some documentation. 525 | 526 | * Better support for Windows and BSD users. 527 | 528 | * Add package installer for the Windows platform. 529 | 530 | #### 0.4.1 531 | Release date: **2011/02/04** 532 | 533 | * New option `-d` added to `git flow init`, to initialize with defaults without 534 | asking for input interactively. Ideal for creating git-flow enabled repos in 535 | custom scripts. 536 | 537 | * The parsing issues related to git-flow feature's flags are now dealt with on 538 | all known platforms. (Fixed #54, #62, #86, #97) 539 | 540 | * Escape queries for detecting branch/tag names. (Fixed #91) 541 | 542 | 543 | #### 0.4 544 | Release date: **2010/10/18** 545 | 546 | * The flag parsing issues of git-flow subcommands are solved for most 547 | platforms. 548 | 549 | * `git flow {feature,hotfix,release} finish` now takes a `-k` flag, to keep the 550 | branch around after finishing. 551 | 552 | * `git flow release finish` takes a `-n` flag, to skip tagging. 553 | 554 | * For consistency, `git flow {release,hotfix}` now, too, have a `publish` and 555 | `track` subcommand, just like `feature`. 556 | 557 | * Various minor fixes. 558 | 559 | 560 | #### 0.3 561 | Release date: **2010/07/22** 562 | 563 | * New subcommands for `git flow feature`: 564 | - **checkout**: 565 | For easily checking out features by their short name. Even allows 566 | unique prefixes as arguments (see below). 567 | 568 | - **pull**: 569 | This subcommand allows you to painlessly work on a feature branch 570 | together with another peer. This is especially valuable for doing 571 | peer reviews of other people's code. For more detailed info, see the 572 | [commit log][1]. 573 | 574 | * Easier addressing of branch names by using name prefixes. 575 | For example, when using: 576 | 577 | git flow feature finish fo 578 | 579 | this automatically finishes the feature branch `foobar` if that's the only 580 | feature branch name starting with `fo`. 581 | 582 | * No force flag anymore for new feature branches 583 | `git flow feature start` lost its `-f` (force) flag. You now don't 584 | have to be in a clean repo anymore to start a new feature branch. This 585 | avoids the manual `git stash`, `git flow feature start`, `git stash 586 | pop` cycle. 587 | 588 | * You can use `git-flow` in stand-alone repo's now. 589 | This means it does not assume you have an `origin` repository. 590 | (Thanks [Mark][2].) 591 | 592 | * No commands fetch from `origin` by default anymore. 593 | There were some issues related to disabling this flag on some platforms. 594 | 595 | * Init guesses branch names you may want to use for `develop` and `master`. 596 | 597 | * Added super-easy installation script. (Thanks [Rick][3].) 598 | 599 | * Added BSD license. 600 | 601 | [1]: http://github.com/nvie/gitflow/commit/f68d405cc3a11e9df3671f567658a6ab6ed8e0a1 602 | [2]: http://github.com/talios 603 | [3]: http://github.com/rickosborne 604 | 605 | #####Older versions 606 | No change history is recorded for pre-0.3 releases. 607 | 608 | #### Glossary 609 | * RFC: Request For Change. This indicates a new or improved function requested 610 | by one or more users. 611 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Authors: 3 | # Copyright 2012-2019 Peter van der Does. All rights reserved. 4 | # 5 | # Original Author: 6 | # Copyright 2010 Vincent Driessen. All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions are met: 10 | # 11 | # 1. Redistributions of source code must retain the above copyright notice, this 12 | # list of conditions and the following disclaimer. 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | prefix=/usr/local 30 | 31 | datarootdir=$(prefix)/share 32 | docdir=$(datarootdir)/doc/gitflow 33 | # files that need mode 755 34 | EXEC_FILES=git-flow 35 | 36 | # files that need mode 644 37 | SCRIPT_FILES =git-flow-init 38 | SCRIPT_FILES+=git-flow-feature 39 | SCRIPT_FILES+=git-flow-bugfix 40 | SCRIPT_FILES+=git-flow-hotfix 41 | SCRIPT_FILES+=git-flow-release 42 | SCRIPT_FILES+=git-flow-support 43 | SCRIPT_FILES+=git-flow-version 44 | SCRIPT_FILES+=git-flow-log 45 | SCRIPT_FILES+=git-flow-config 46 | SCRIPT_FILES+=gitflow-common 47 | SCRIPT_FILES+=gitflow-shFlags 48 | 49 | # Hook files 50 | HOOK_FILES=$(wildcard hooks/*) 51 | 52 | all: 53 | @echo "usage: make install" 54 | @echo " make uninstall" 55 | 56 | install: 57 | install -d -m 0755 $(prefix)/bin 58 | install -d -m 0755 $(docdir)/hooks 59 | install -m 0755 $(EXEC_FILES) $(prefix)/bin 60 | install -m 0644 $(SCRIPT_FILES) $(prefix)/bin 61 | install -m 0644 $(HOOK_FILES) $(docdir)/hooks 62 | 63 | uninstall: 64 | test -d $(prefix)/bin && \ 65 | cd $(prefix)/bin && \ 66 | rm -f $(EXEC_FILES) $(SCRIPT_FILES) 67 | test -d $(docdir) && \ 68 | rm -rf $(docdir) 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # git-flow (AVH Edition) 2 | 3 | A collection of Git extensions to provide high-level repository operations 4 | for Vincent Driessen's [branching model](http://nvie.com/git-model "original 5 | blog post"). This fork adds functionality not added to the original branch. 6 | 7 | 8 | ## Getting started 9 | 10 | For the best introduction to get started with `git flow`, please read Jeff 11 | Kreeftmeijer's blog post: 12 | 13 | [http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/](http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/) 14 | 15 | Or have a look at one of these screen casts: 16 | 17 | * [How to use a scalable Git branching model called git-flow](http://buildamodule.com/video/change-management-and-version-control-deploying-releases-features-and-fixes-with-git-how-to-use-a-scalable-git-branching-model-called-gitflow) (by Build a Module) 18 | * [A short introduction to git-flow](http://vimeo.com/16018419) (by Mark Derricutt) 19 | * [On the path with git-flow](https://vimeo.com/codesherpas/on-the-path-gitflow) (by Dave Bock) 20 | 21 | A quick cheatsheet was made by Daniel Kummer: 22 | 23 | [http://danielkummer.github.io/git-flow-cheatsheet/](http://danielkummer.github.io/git-flow-cheatsheet/) 24 | 25 | ## Installing git-flow 26 | 27 | See the Wiki for up-to-date [Installation Instructions](https://github.com/petervanderdoes/gitflow-avh/wiki/Installation). 28 | 29 | 30 | ## Integration with your shell 31 | 32 | For those who use the [Bash](http://www.gnu.org/software/bash/) or [ZSH](http://www.zsh.org) 33 | shell, you can use my [fork of git-flow-completion](https://github.com/petervanderdoes/git-flow-completion) 34 | which includes several additions for git-flow (AVH Edition), or you can use the 35 | original [git-flow-completion](http://github.com/bobthecow/git-flow-completion) 36 | project by [bobthecow](http://github.com/bobthecow). Both offer tab-completion 37 | for git-flow subcommands and branch names with my fork including tab-completion 38 | for the commands not found in the original git-flow. 39 | 40 | 41 | ## FAQ 42 | 43 | * See the [FAQ](http://github.com/petervanderdoes/gitflow-avh/wiki/FAQ) section 44 | of the project Wiki. 45 | * Version Numbering Scheme. 46 | Starting with version 1.0, the project uses the following scheme: 47 | \.\.\\ 48 | * AVH is the acronym of "A VirtualHome" 49 | 50 | ## Please help out 51 | 52 | This project is under constant development. Feedback and suggestions are very 53 | welcome and I encourage you to use the [Issues 54 | list](http://github.com/petervanderdoes/gitflow-avh/issues) on Github to provide that 55 | feedback. 56 | 57 | Feel free to fork this repository and to commit your additions. For a list of 58 | all contributors, please see the [AUTHORS](AUTHORS) file. 59 | 60 | Any questions, tips, or general discussion can be posted to the Google group: 61 | [http://groups.google.com/group/gitflow-users](http://groups.google.com/group/gitflow-users) 62 | This is the original group set up to support the nvie branch, but I am monitoring 63 | the list as well for any questions related to my version. 64 | When you do post a question on the list please indicate which version you are, 65 | using the complete version number. 66 | 67 | ## Contributing 68 | 69 | Fork the repository. Then, run: 70 | 71 | ```shell 72 | git clone -b master git@github.com:/gitflow-avh.git 73 | cd gitflow-avh 74 | ``` 75 | 76 | The `-b master` switch has to be added since the fork operation automatically 77 | clones the `develop` branch of the official gitflow repository and cloning it 78 | results in a local repository with just a `develop` branch. 79 | 80 | If you do not have gitflow installed yet install it by running `make && make install`. 81 | 82 | After that initialize the local gitflow repository with gitflow itself: 83 | 84 | ```shell 85 | git flow init -d 86 | git flow feature start 87 | ``` 88 | 89 | Then, do work and commit your changes. 90 | 91 | ```shell 92 | git flow feature publish 93 | ``` 94 | 95 | When done, open a pull request to your feature branch. 96 | 97 | ## License terms 98 | 99 | git-flow is published under the FreeBSD License, see the 100 | [LICENSE](LICENSE) file. Although the FreeBSD License does not require you to 101 | share any modifications you make to the source code, you are very much 102 | encouraged and invited to contribute back your modifications to the community, 103 | preferably in a Github fork, of course. 104 | 105 | 106 | ## git flow usage 107 | 108 | ### Initialization 109 | 110 | To initialize a new repo with the basic branch structure, use: 111 | 112 | git flow init [-d] 113 | 114 | This will then interactively prompt you with some questions on which branches 115 | you would like to use as development and production branches, and how you 116 | would like your prefixes be named. You may simply press Return on any of 117 | those questions to accept the (sane) default suggestions. 118 | 119 | The ``-d`` flag will accept all defaults. 120 | 121 | ![Screencast git flow init](http://i.imgur.com/lFQbY5V.gif) 122 | 123 | ### Creating feature/release/hotfix/support branches 124 | 125 | * To list/start/finish/delete feature branches, use: 126 | 127 | ```shell 128 | git flow feature 129 | git flow feature start [] 130 | git flow feature finish 131 | git flow feature delete 132 | ``` 133 | 134 | For feature branches, the `` arg must be a branch, when omitted it defaults to the develop branch. 135 | 136 | * To push/pull a feature branch to the remote repository, use: 137 | 138 | ```shell 139 | git flow feature publish 140 | git flow feature track 141 | ``` 142 | 143 | * To list/start/finish/delete release branches, use: 144 | 145 | ```shell 146 | git flow release 147 | git flow release start [] 148 | git flow release finish 149 | git flow release delete 150 | ``` 151 | 152 | For release branches, the `` arg must be a branch, when omitted it defaults to the develop branch. 153 | 154 | * To list/start/finish/delete hotfix branches, use: 155 | 156 | ```shell 157 | git flow hotfix 158 | git flow hotfix start [] 159 | git flow hotfix finish 160 | git flow hotfix delete 161 | ``` 162 | 163 | For hotfix branches, the `` arg must be a branch, when omitted it defaults to the production branch. 164 | 165 | * To list/start support branches, use: 166 | 167 | ```shell 168 | git flow support 169 | git flow support start 170 | ``` 171 | 172 | For support branches, the `` arg must be a branch, when omitted it defaults to the production branch. 173 | 174 | ### Share features with others 175 | 176 | You can easily publish a feature you are working on. The reason can be to allow other programmers to work on it or to access it from another machine. The publish/track feature of gitflow simplify the creation of a remote branch and its tracking. 177 | 178 | When you want to publish a feature just use: 179 | ```shell 180 | git flow feature publish 181 | ``` 182 | 183 | or, if you already are into the `feature/` branch, just issue: 184 | ```shell 185 | git flow feature publish 186 | ``` 187 | 188 | Now if you execute `git branch -avv` you will see that your branch `feature/` tracks `[origin/feature/]`. To track the same remote branch in another clone of the same repository use: 189 | ```shell 190 | git flow feature track 191 | ``` 192 | 193 | This will create a local feature `feature/` that tracks the same remote branch as the original one, that is `origin/feature/`. 194 | 195 | When one developer (depending on your work flow) finishes working on the feature he or she can issue `git flow feature finish ` and this will automatically delete the remote branch. All other developers shall then run: 196 | ```shell 197 | git flow feature delete 198 | ``` 199 | 200 | to get rid of the local feature that tracks a remote branch that no more exist. 201 | 202 | ### Share hotfixes with others 203 | 204 | You can publish an hotfix you are working on. The reason can be to allow other programmers to work on it or validate it or to access it from another machine. 205 | 206 | When you want to publish an hotfix just use (as you did for features): 207 | ```shell 208 | git flow hotfix publish 209 | ``` 210 | 211 | or, if you already are into the `hotfix/` branch, just issue: 212 | ```shell 213 | git flow hotfix publish 214 | ``` 215 | 216 | Other developers can now update their repositories and checkout the hotfix: 217 | ```shell 218 | git pull 219 | git checkout hotfix/ 220 | ``` 221 | and eventually finish it: 222 | ```shell 223 | git flow hotfix finish 224 | ``` 225 | 226 | 227 | ### Using Hooks and Filters 228 | 229 | For a wide variety of commands hooks or filters can be called before and after 230 | the command. 231 | The files should be placed in .git/hooks 232 | In the directory hooks you can find examples of all the hooks available. 233 | 234 | ## Showing your appreciation 235 | 236 | Of course, the best way to show your appreciation for the git-flow tool itself 237 | remains contributing to the community. If you'd like to show your appreciation 238 | in another way, however, consider donating through PayPal: 239 | 240 | [![PayPal][2]][1] 241 | 242 | [1]: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=S85FXJ9EBHAF2&lc=US&item_name=gitflow&item_number=gitflow&no_note=0&cn=Add%20special%20instructions%20to%20the%20seller&no_shipping=1&rm=1&return=https%3a%2f%2fgithub%2ecom%2fpetervanderdoes%2fgitflow&cancel_return=https%3a%2f%2fgithub%2ecom%2fpetervanderdoes%2fgitflow¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted 243 | 244 | [2]: https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif 245 | -------------------------------------------------------------------------------- /contrib/gitflow-installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # git-flow make-less installer for *nix systems, by Rick Osborne 4 | # Based on the git-flow core Makefile: 5 | # http://github.com/petervanderdoes/gitflow-avh/blob/master/Makefile 6 | 7 | # Licensed under the same restrictions as git-flow: 8 | # http://github.com/petervanderdoes/gitflow-avh/blob/develop/LICENSE 9 | 10 | # Updated for the fork at petervanderdoes 11 | 12 | usage() { 13 | echo "Usage: [environment] gitflow-installer.sh [install|uninstall] [stable|develop|version] [tag]" 14 | echo "Environment:" 15 | echo " PREFIX=$PREFIX" 16 | echo " REPO_HOME=$REPO_HOME" 17 | echo " REPO_NAME=$REPO_NAME" 18 | exit 1 19 | } 20 | 21 | # Does this need to be smarter for each host OS? 22 | if [ -z "$PREFIX" ] ; then 23 | PREFIX="/usr/local" 24 | fi 25 | 26 | if [ -z "$REPO_NAME" ] ; then 27 | REPO_NAME="gitflow" 28 | fi 29 | 30 | if [ -z "$REPO_HOME" ] ; then 31 | REPO_HOME="https://github.com/petervanderdoes/gitflow-avh.git" 32 | fi 33 | 34 | EXEC_PREFIX="$PREFIX" 35 | BINDIR="$EXEC_PREFIX/bin" 36 | DATAROOTDIR="$PREFIX/share" 37 | DOCDIR="$DATAROOTDIR/doc/gitflow" 38 | 39 | EXEC_FILES="git-flow" 40 | SCRIPT_FILES="git-flow-init git-flow-feature git-flow-bugfix git-flow-hotfix git-flow-release git-flow-support git-flow-version gitflow-common gitflow-shFlags git-flow-config" 41 | HOOK_FILES="$REPO_NAME/hooks/*" 42 | 43 | 44 | echo "### git-flow no-make installer ###" 45 | 46 | case "$1" in 47 | uninstall) 48 | echo "Uninstalling git-flow from $PREFIX" 49 | if [ -d "$BINDIR" ] ; then 50 | for script_file in $SCRIPT_FILES $EXEC_FILES ; do 51 | echo "rm -vf $BINDIR/$script_file" 52 | rm -vf "$BINDIR/$script_file" 53 | done 54 | rm -rf "$DOCDIR" 55 | else 56 | echo "The '$BINDIR' directory was not found." 57 | fi 58 | exit 59 | ;; 60 | help) 61 | usage 62 | exit 63 | ;; 64 | install) 65 | if [ -z $2 ]; then 66 | usage 67 | exit 68 | fi 69 | echo "Installing git-flow to $BINDIR" 70 | if [ -d "$REPO_NAME" -a -d "$REPO_NAME/.git" ] ; then 71 | echo "Using existing repo: $REPO_NAME" 72 | else 73 | echo "Cloning repo from GitHub to $REPO_NAME" 74 | git clone "$REPO_HOME" "$REPO_NAME" 75 | fi 76 | cd "$REPO_NAME" 77 | git pull 78 | cd "$OLDPWD" 79 | case "$2" in 80 | stable) 81 | cd "$REPO_NAME" 82 | git checkout master 83 | cd "$OLDPWD" 84 | ;; 85 | develop) 86 | cd "$REPO_NAME" 87 | git checkout develop 88 | cd "$OLDPWD" 89 | ;; 90 | version) 91 | cd "$REPO_NAME" 92 | git checkout tags/$3 93 | cd "$OLDPWD" 94 | ;; 95 | *) 96 | usage 97 | exit 98 | ;; 99 | esac 100 | install -v -d -m 0755 "$PREFIX/bin" 101 | install -v -d -m 0755 "$DOCDIR/hooks" 102 | for exec_file in $EXEC_FILES ; do 103 | install -v -m 0755 "$REPO_NAME/$exec_file" "$BINDIR" 104 | done 105 | for script_file in $SCRIPT_FILES ; do 106 | install -v -m 0644 "$REPO_NAME/$script_file" "$BINDIR" 107 | done 108 | for hook_file in $HOOK_FILES ; do 109 | install -v -m 0644 "$hook_file" "$DOCDIR/hooks" 110 | done 111 | exit 112 | ;; 113 | *) 114 | usage 115 | exit 116 | ;; 117 | esac 118 | -------------------------------------------------------------------------------- /contrib/msysgit-install.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | if not "%~1"=="" set GIT_HOME=%~f1 4 | if "%GIT_HOME%"=="" call :FindGitHome "git.cmd" 5 | 6 | if exist "%GIT_HOME%" goto :GitHomeOK 7 | 8 | echo MsysGit installation directory not found.>&2 9 | echo Try to give the directory name on the command line:>&2 10 | echo %0 "%ProgramFiles%\Git" 11 | endlocal 12 | exit /B 1 13 | 14 | :GitHomeOK 15 | set ERR=0 16 | 17 | echo Installing gitflow into "%GIT_HOME%"... 18 | 19 | call :ChkGetopt getopt.exe || set ERR=1 20 | if %ERR%==1 goto :End 21 | echo getopt.exe... Found 22 | 23 | if not exist "%GIT_HOME%\bin\git-flow" goto :Install 24 | echo GitFlow is already installed.>&2 25 | set /p mychoice="Do you want to replace it [y/n]" 26 | if "%mychoice%"=="y" goto :DeleteOldFiles 27 | goto :Abort 28 | 29 | :DeleteOldFiles 30 | echo Deleting old files... 31 | for /F %%i in ("%GIT_HOME%\git-flow*" "%GIT_HOME%\gitflow-*") do if exist "%%~fi" del /F /Q "%%~fi" 32 | 33 | :Install 34 | echo Copying files... 35 | ::goto :EOF 36 | xcopy "%~dp0\..\git-flow" "%GIT_HOME%\bin" /Y /R /F 37 | if errorlevel 4 if not errorlevel 5 goto :AccessDenied 38 | if errorlevel 1 set ERR=1 39 | xcopy "%~dp0\..\git-flow*" "%GIT_HOME%\bin" /Y /R /F || set ERR=1 40 | xcopy "%~dp0\..\gitflow-*" "%GIT_HOME%\bin" /Y /R /F || set ERR=1 41 | 42 | if %ERR%==1 choice /T 30 /C Y /D Y /M "Some unexpected errors happened. Sorry, you'll have to fix them by yourself." 43 | 44 | :End 45 | endlocal & exit /B %ERR% 46 | goto :EOF 47 | 48 | :AccessDenied 49 | set ERR=1 50 | echo. 51 | echo You should run this script with "Full Administrator" rights:>&2 52 | echo - Right-click with Shift on the script from the Explorer>&2 53 | echo - Select "Run as administrator">&2 54 | choice /T 30 /C YN /D Y /N >nul 55 | goto :End 56 | 57 | :Abort 58 | echo Installation canceled.>&2 59 | set ERR=1 60 | goto :End 61 | 62 | :ChkGetopt 63 | :: %1 is getopt.exe 64 | if exist "%GIT_HOME%\bin\%1" goto :EOF 65 | if exist "%~f$PATH:1" goto :EOF 66 | echo %GIT_HOME%\bin\%1 not found.>&2 67 | echo You have to install this file manually. See the GitFlow README. 68 | exit /B 1 69 | 70 | :FindGitHome 71 | setlocal 72 | set GIT_CMD_DIR=%~dp$PATH:1 73 | if "%GIT_CMD_DIR%"=="" endlocal & goto :EOF 74 | endlocal & set GIT_HOME=%GIT_CMD_DIR:~0,-5% 75 | goto :EOF 76 | -------------------------------------------------------------------------------- /git-flow: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # git-flow -- A collection of Git extensions to provide high-level 4 | # repository operations for Vincent Driessen's branching model. 5 | # 6 | # A blog post presenting this model is found at: 7 | # http://blog.avirtualhome.com/development-workflow-using-git/ 8 | # 9 | # Feel free to contribute to this project at: 10 | # http://github.com/petervanderdoes/gitflow 11 | # 12 | # Authors: 13 | # Copyright 2012-2019 Peter van der Does. All rights reserved. 14 | # 15 | # Original Author: 16 | # Copyright 2010 Vincent Driessen. All rights reserved. 17 | # 18 | # Redistribution and use in source and binary forms, with or without 19 | # modification, are permitted provided that the following conditions are met: 20 | # 21 | # 1. Redistributions of source code must retain the above copyright notice, this 22 | # list of conditions and the following disclaimer. 23 | # 2. Redistributions in binary form must reproduce the above copyright notice, 24 | # this list of conditions and the following disclaimer in the documentation 25 | # and/or other materials provided with the distribution. 26 | # 27 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 28 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 31 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 34 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | # 38 | # 39 | # enable debug mode 40 | if [ "$DEBUG" = "yes" ]; then 41 | set -x 42 | fi 43 | 44 | # Setup the GITFLOW_DIR for different operating systems. 45 | # This is mostly to make sure that we get the correct directory when the 46 | # git-flow file is a symbolic link 47 | case $(uname -s) in 48 | Linux) 49 | export GITFLOW_DIR=$(dirname "$(readlink -e "$0")") 50 | ;; 51 | FreeBSD|OpenBSD|NetBSD) 52 | export FLAGS_GETOPT_CMD='/usr/local/bin/getopt' 53 | export GITFLOW_DIR=$(dirname "$(realpath "$0")") 54 | ;; 55 | Darwin) 56 | PRG="$0" 57 | while [ -h "$PRG" ]; do 58 | link=$(readlink "$PRG") 59 | if expr "$link" : '/.*' > /dev/null; then 60 | PRG="$link" 61 | else 62 | PRG="$(dirname "$PRG")/$link" 63 | fi 64 | done 65 | export GITFLOW_DIR=$(dirname "$PRG") 66 | ;; 67 | *MINGW*) 68 | export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 69 | pwd () { 70 | builtin pwd -W 71 | } 72 | ;; 73 | *) 74 | # The sed expression here replaces all backslashes by forward slashes. 75 | # This helps our Windows users, while not bothering our Unix users.) 76 | export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 77 | ;; 78 | esac 79 | 80 | # Extra environment settings 81 | if [ -f ~/.gitflow_export ]; then 82 | if grep -E 'GITFLOW_FLAG_(SHOWCOMMANDS|INIT|FEATURE|HOTFIX|RELEASE|SUPPORT)' ~/.gitflow_export > /dev/null; then 83 | echo "Using environment variables for \"showcommands\", \"init\", \"feature\", \"hotfix\", \"release\" and \"support\" in ~/.gitflow_export has deprecated, use git config instead." 84 | echo "" 85 | exit 1; 86 | else 87 | . ~/.gitflow_export 88 | fi 89 | fi 90 | 91 | usage() { 92 | echo "usage: git flow " 93 | echo 94 | echo "Available subcommands are:" 95 | echo " init Initialize a new git repo with support for the branching model." 96 | echo " feature Manage your feature branches." 97 | echo " bugfix Manage your bugfix branches." 98 | echo " release Manage your release branches." 99 | echo " hotfix Manage your hotfix branches." 100 | echo " support Manage your support branches." 101 | echo " version Shows version information." 102 | echo " config Manage your git-flow configuration." 103 | echo " log Show log deviating from base branch." 104 | echo 105 | echo "Try 'git flow help' for details." 106 | } 107 | 108 | main() { 109 | if [ $# -lt 1 ]; then 110 | usage 111 | exit 1 112 | fi 113 | 114 | # Use the shFlags project to parse the command line arguments 115 | . "$GITFLOW_DIR/gitflow-shFlags" 116 | FLAGS_PARENT="git flow" 117 | 118 | # Load common functionality 119 | . "$GITFLOW_DIR/gitflow-common" 120 | 121 | # allow user to request git action logging 122 | DEFINE_boolean 'showcommands' false 'Show actions taken (git commands)' 123 | # but if the user prefers that the logging is always on, 124 | # use the environmental variables. 125 | gitflow_override_flag_boolean 'showcommands' 'showcommands' 126 | 127 | # Sanity checks 128 | SUBCOMMAND="$1"; shift 129 | if [ "${SUBCOMMAND}" = "finish" ] || [ "${SUBCOMMAND}" = "delete" ] || [ "${SUBCOMMAND}" = "publish" ] || [ "${SUBCOMMAND}" = "rebase" ]; then 130 | _current_branch=$(git_current_branch) 131 | if gitflow_is_prefixed_branch "${_current_branch}"; then 132 | if startswith "${_current_branch}" $(git config --get gitflow.prefix.feature); then 133 | SUBACTION="${SUBCOMMAND}" 134 | SUBCOMMAND="feature" 135 | _prefix=$(git config --get gitflow.prefix.feature) 136 | _short_branch_name=$(echo ${_current_branch#*${_prefix}}) 137 | else 138 | if startswith "${_current_branch}" $(git config --get gitflow.prefix.bugfix); then 139 | SUBACTION="${SUBCOMMAND}" 140 | SUBCOMMAND="bugfix" 141 | _prefix=$(git config --get gitflow.prefix.bugfix) 142 | _short_branch_name=$(echo ${_current_branch#*${_prefix}}) 143 | else 144 | if startswith "${_current_branch}" $(git config --get gitflow.prefix.hotfix); then 145 | SUBACTION="${SUBCOMMAND}" 146 | SUBCOMMAND="hotfix" 147 | _prefix=$(git config --get gitflow.prefix.hotfix) 148 | _short_branch_name=$(echo ${_current_branch#*${_prefix}}) 149 | else 150 | if startswith "${_current_branch}" $(git config --get gitflow.prefix.release); then 151 | SUBACTION="${SUBCOMMAND}" 152 | SUBCOMMAND="release" 153 | _prefix=$(git config --get gitflow.prefix.release) 154 | _short_branch_name=$(echo ${_current_branch#*${_prefix}}) 155 | fi 156 | fi 157 | fi 158 | fi 159 | fi 160 | fi 161 | 162 | if [ ! -e "$GITFLOW_DIR/git-flow-$SUBCOMMAND" ]; then 163 | usage 164 | exit 1 165 | fi 166 | 167 | # Run command 168 | . "$GITFLOW_DIR/git-flow-$SUBCOMMAND" 169 | FLAGS_PARENT="git flow $SUBCOMMAND" 170 | 171 | if [ -z "${SUBACTION}" ]; then 172 | # If the first argument is a flag, it starts with '-', we interpret this 173 | # argument as a flag for the default command. 174 | if startswith "$1" "-"; then 175 | SUBACTION="default" 176 | elif [ -z "$1" ]; then 177 | SUBACTION="default" 178 | else 179 | SUBACTION="$1" 180 | shift 181 | # Do not allow direct calls to subactions with an underscore. 182 | if $(contains "$SUBACTION" "_"); then 183 | warn "Unknown subcommand: '$SUBACTION'" 184 | usage 185 | exit 1 186 | fi 187 | # Replace the dash with an underscore as bash doesn't allow a dash 188 | # in the function name. 189 | SUBACTION=$(echo "$SUBACTION" |tr '-' '_') 190 | fi 191 | fi 192 | 193 | if ! type "cmd_$SUBACTION" >/dev/null 2>&1; then 194 | warn "Unknown subcommand: '$SUBACTION'" 195 | usage 196 | exit 1 197 | fi 198 | 199 | # Run the specified action 200 | if [ $SUBACTION != "help" ] && [ $SUBCOMMAND != "init" ]; then 201 | initialize 202 | fi 203 | if [ $SUBACTION != 'default' ]; then 204 | FLAGS_PARENT="git flow $SUBCOMMAND $SUBACTION" 205 | fi 206 | 207 | cmd_$SUBACTION "$@" "${_short_branch_name}" 208 | } 209 | main "$@" 210 | -------------------------------------------------------------------------------- /git-flow-bugfix: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # vim:et:ft=sh:sts=2:sw=2 3 | # 4 | # git-flow -- A collection of Git extensions to provide high-level 5 | # repository operations for Vincent Driessen's branching model. 6 | # 7 | # A blog post presenting this model is found at: 8 | # http://blog.avirtualhome.com/development-workflow-using-git/ 9 | # 10 | # Feel free to contribute to this project at: 11 | # http://github.com/petervanderdoes/gitflow 12 | # 13 | # Authors: 14 | # Copyright 2012-2019 Peter van der Does. All rights reserved. 15 | # 16 | # Original Author: 17 | # Copyright 2010 Vincent Driessen. All rights reserved. 18 | # 19 | # Redistribution and use in source and binary forms, with or without 20 | # modification, are permitted provided that the following conditions are met: 21 | # 22 | # 1. Redistributions of source code must retain the above copyright notice, this 23 | # list of conditions and the following disclaimer. 24 | # 2. Redistributions in binary form must reproduce the above copyright notice, 25 | # this list of conditions and the following disclaimer in the documentation 26 | # and/or other materials provided with the distribution. 27 | # 28 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 29 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 30 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 31 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 32 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 33 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 35 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 37 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | # 39 | 40 | initialize() { 41 | require_git_repo 42 | require_gitflow_initialized 43 | git config --get gitflow.prefix.bugfix >/dev/null 2>&1 || die "Bugfix prefix not set. Please run 'git flow init'." 44 | gitflow_load_settings 45 | PREFIX=$(git config --get gitflow.prefix.bugfix) 46 | } 47 | 48 | usage() { 49 | OPTIONS_SPEC="\ 50 | git flow bugfix [list] 51 | git flow bugfix start 52 | git flow bugfix finish 53 | git flow bugfix publish 54 | git flow bugfix track 55 | git flow bugfix diff 56 | git flow bugfix rebase 57 | git flow bugfix checkout 58 | git flow bugfix pull 59 | git flow bugfix delete 60 | 61 | Manage your bugfix branches. 62 | 63 | For more specific help type the command followed by --help 64 | -- 65 | " 66 | flags_help 67 | } 68 | 69 | cmd_default() { 70 | cmd_list "$@" 71 | } 72 | 73 | cmd_list() { 74 | OPTIONS_SPEC="\ 75 | git flow bugfix [list] [-h] [-v] 76 | 77 | Lists all the existing bugfix branches in the local repository. 78 | -- 79 | h,help! Show this help 80 | v,verbose Verbose (more) output 81 | " 82 | local bugfix_branches current_branch width branch len 83 | local base develop_sha branch_sha 84 | 85 | # Define flags 86 | DEFINE_boolean 'verbose' false 'verbose (more) output' v 87 | 88 | # Parse argun=ments 89 | parse_args "$@" 90 | 91 | bugfix_branches=$(git_local_branches_prefixed "$PREFIX") 92 | if [ -z "$bugfix_branches" ]; then 93 | warn "No bugfix branches exist." 94 | warn "" 95 | warn "You can start a new bugfix branch:" 96 | warn "" 97 | warn " git flow bugfix start []" 98 | warn "" 99 | exit 0 100 | fi 101 | current_branch=$(git_current_branch) 102 | 103 | # Determine column width first 104 | width=0 105 | for branch in $bugfix_branches; do 106 | len=${#branch} 107 | width=$(max $width $len) 108 | done 109 | width=$(($width+3-${#PREFIX})) 110 | 111 | for branch in $bugfix_branches; do 112 | base=$(git merge-base "$branch" "$DEVELOP_BRANCH") 113 | develop_sha=$(git rev-parse "$DEVELOP_BRANCH") 114 | branch_sha=$(git rev-parse "$branch") 115 | if [ "$branch" = "$current_branch" ]; then 116 | printf "* " 117 | else 118 | printf " " 119 | fi 120 | if flag verbose; then 121 | printf "%-${width}s" "${branch#$PREFIX}" 122 | if [ "$branch_sha" = "$develop_sha" ]; then 123 | printf "(no commits yet)" 124 | elif [ "$base" = "$branch_sha" ]; then 125 | printf "(is behind develop, may ff)" 126 | elif [ "$base" = "$develop_sha" ]; then 127 | printf "(based on latest develop)" 128 | else 129 | printf "(may be rebased)" 130 | fi 131 | else 132 | printf "%s" "${branch#$PREFIX}" 133 | fi 134 | echo 135 | done 136 | } 137 | 138 | cmd_help() { 139 | usage 140 | exit 0 141 | } 142 | 143 | # Parse arguments and set common variables 144 | parse_args() { 145 | FLAGS "$@" || exit $? 146 | eval set -- "${FLAGS_ARGV}" 147 | 148 | # read arguments into global variables 149 | if [ -z $1 ]; then 150 | NAME='' 151 | else 152 | NAME=$1 153 | fi 154 | BRANCH=$PREFIX$NAME 155 | } 156 | 157 | parse_remote_name() { 158 | # Parse arguments 159 | FLAGS "$@" || exit $? 160 | eval set -- "${FLAGS_ARGV}" 161 | 162 | # read arguments into global variables 163 | if [ -z $1 ]; then 164 | REMOTE='' 165 | else 166 | REMOTE=$1 167 | fi 168 | 169 | if [ -z $2 ]; then 170 | NAME='' 171 | else 172 | NAME=$2 173 | fi 174 | BRANCH=$PREFIX$NAME 175 | } 176 | 177 | cmd_start() { 178 | OPTIONS_SPEC="\ 179 | git flow bugfix start [-h] [-F] [] 180 | 181 | Start new bugfix , optionally basing it on instead of 182 | -- 183 | h,help! Show this help 184 | showcommands! Show git commands while executing them 185 | F,[no]fetch Fetch from origin before performing local operation 186 | " 187 | local base 188 | 189 | # Define flags 190 | DEFINE_boolean 'fetch' false 'fetch from origin before performing local operation' F 191 | 192 | # Override defaults with values from config 193 | gitflow_override_flag_boolean "bugfix.start.fetch" "fetch" 194 | 195 | # Parse arguments 196 | parse_args "$@" 197 | eval set -- "${FLAGS_ARGV}" 198 | base=${2:-$DEVELOP_BRANCH} 199 | 200 | require_base_is_local_branch "$base" 201 | gitflow_require_name_arg 202 | 203 | # Update the local repo with remote changes, if asked 204 | if flag fetch; then 205 | git_fetch_branch "$ORIGIN" "$base" 206 | fi 207 | 208 | # Sanity checks 209 | require_branch_absent "$BRANCH" 210 | 211 | # If the origin branch counterpart exists, assert that the local branch 212 | # isn't behind it (to avoid unnecessary rebasing) 213 | if git_remote_branch_exists "$ORIGIN/$base"; then 214 | require_branches_equal "$base" "$ORIGIN/$base" 215 | fi 216 | 217 | run_pre_hook "$NAME" "$ORIGIN" "$BRANCH" "$base" 218 | 219 | gitflow_config_set_base_branch $base $BRANCH 220 | 221 | # create branch 222 | git_do checkout -b "$BRANCH" "$base" || die "Could not create bugfix branch '$BRANCH'." 223 | 224 | run_post_hook "$NAME" "$ORIGIN" "$BRANCH" "$base" 225 | 226 | echo 227 | echo "Summary of actions:" 228 | echo "- A new branch '$BRANCH' was created, based on '$base'" 229 | echo "- You are now on branch '$(git_current_branch)'" 230 | echo "" 231 | echo "Now, start committing on your bugfix. When done, use:" 232 | echo "" 233 | echo " git flow bugfix finish $NAME" 234 | echo 235 | } 236 | 237 | cmd_finish() { 238 | OPTIONS_SPEC="\ 239 | git flow bugfix finish [-h] [-F] [-r] [-p] [-k] [-D] [-S] [--no-ff] 240 | 241 | Finish bugfix 242 | -- 243 | h,help! Show this help 244 | showcommands! Show git commands while executing them 245 | F,[no]fetch Fetch from origin before performing finish 246 | r,[no]rebase Rebase before merging 247 | p,[no]preserve-merges Preserve merges while rebasing 248 | [no]push Push to origin after performing finish 249 | k,[no]keep Keep branch after performing finish 250 | keepremote! Keep the remote branch 251 | keeplocal! Keep the local branch 252 | D,[no]force_delete Force delete bugfix branch after finish 253 | S,[no]squash Squash bugfix during merge 254 | no-ff! Never fast-forward during the merge 255 | " 256 | local finish_base 257 | 258 | # Define flags 259 | DEFINE_boolean 'fetch' false "fetch from $ORIGIN before performing finish" F 260 | DEFINE_boolean 'rebase' false "rebase before merging" r 261 | DEFINE_boolean 'preserve-merges' false 'try to recreate merges while rebasing' p 262 | DEFINE_boolean 'push' false "push to $ORIGIN after performing finish" 263 | DEFINE_boolean 'keep' false "keep branch after performing finish" k 264 | DEFINE_boolean 'keepremote' false "keep the remote branch" 265 | DEFINE_boolean 'keeplocal' false "keep the local branch" 266 | DEFINE_boolean 'force_delete' false "force delete bugfix branch after finish" D 267 | DEFINE_boolean 'squash' false "squash bugfix during merge" S 268 | DEFINE_boolean 'squash-info' false "add branch info during squash" 269 | DEFINE_boolean 'no-ff!' false "Don't fast-forward ever during merge " 270 | 271 | # Override defaults with values from config 272 | gitflow_override_flag_boolean "bugfix.finish.fetch" "fetch" 273 | gitflow_override_flag_boolean "bugfix.finish.rebase" "rebase" 274 | gitflow_override_flag_boolean "bugfix.finish.preserve-merges" "preserve_merges" 275 | gitflow_override_flag_boolean "bugfix.finish.push" "push" 276 | gitflow_override_flag_boolean "bugfix.finish.keep" "keep" 277 | gitflow_override_flag_boolean "bugfix.finish.keepremote" "keepremote" 278 | gitflow_override_flag_boolean "bugfix.finish.keeplocal" "keeplocal" 279 | gitflow_override_flag_boolean "bugfix.finish.force-delete" "force_delete" 280 | gitflow_override_flag_boolean "bugfix.finish.squash" "squash" 281 | gitflow_override_flag_boolean "bugfix.finish.squash-info" "squash_info" 282 | gitflow_override_flag_boolean "bugfix.finish.no-ff" "no_ff" 283 | 284 | # Parse arguments 285 | parse_args "$@" 286 | 287 | # Use current branch if no name is given 288 | if [ "$NAME" = "" ]; then 289 | gitflow_use_current_branch_name 290 | fi 291 | 292 | # Keeping both branches implies the --keep flag to be true. 293 | if flag keepremote && flag keeplocal; then 294 | FLAGS_keep=$FLAGS_TRUE 295 | fi 296 | 297 | # Sanity checks 298 | require_branch "$BRANCH" 299 | 300 | BASE_BRANCH=$(gitflow_config_get_base_branch $BRANCH) 301 | BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH} 302 | git_local_branch_exists "$BASE_BRANCH" || die "The base '$BASE_BRANCH' doesn't exists locally or is not a branch. Can't finish the bugfix branch '$BRANCH'." 303 | 304 | # Detect if we're restoring from a merge conflict 305 | if [ -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE" ]; then 306 | # 307 | # TODO: detect that we're working on the correct branch here! 308 | # The user need not necessarily have given the same $NAME twice here 309 | # (although he/she should). 310 | # 311 | 312 | # TODO: git_is_clean_working_tree() should provide an alternative 313 | # exit code for "unmerged changes in working tree", which we should 314 | # actually be testing for here 315 | if git_is_clean_working_tree; then 316 | finish_base=$(cat "$DOT_GIT_DIR/.gitflow/MERGE_BASE") 317 | 318 | # Since the working tree is now clean, either the user did a 319 | # successful merge manually, or the merge was cancelled. 320 | # We detect this using git_is_branch_merged_into() 321 | if git_is_branch_merged_into "$BRANCH" "$finish_base"; then 322 | rm -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE" 323 | helper_finish_cleanup 324 | exit 0 325 | else 326 | # If the user cancelled the merge and decided to wait until 327 | # later,that's fine. But we have to acknowledge this by 328 | # removing the MERGE_BASE file and continuing normal execution 329 | # of the finish 330 | rm -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE" 331 | fi 332 | else 333 | echo 334 | echo "Merge conflicts not resolved yet, use:" 335 | echo " git mergetool" 336 | echo " git commit" 337 | echo 338 | echo "You can then complete the finish by running it again:" 339 | echo " git flow bugfix finish $NAME" 340 | echo 341 | exit 1 342 | fi 343 | fi 344 | 345 | # Sanity checks 346 | require_clean_working_tree 347 | 348 | # We always fetch the Branch from Origin 349 | # This is done to avoid possible commits on the remote that are not 350 | # merged into the local branch 351 | if git_remote_branch_exists "$ORIGIN/$BRANCH"; then 352 | git_fetch_branch "$ORIGIN" "$BRANCH" 353 | fi 354 | 355 | # Update local branches with remote branches 356 | if flag fetch; then 357 | git_fetch_branch "$ORIGIN" "$BASE_BRANCH" 358 | fi 359 | 360 | # Check if the local branches have all the commits from the remote branches 361 | if git_remote_branch_exists "$ORIGIN/$BRANCH"; then 362 | require_branches_equal "$BRANCH" "$ORIGIN/$BRANCH" 363 | fi 364 | if git_remote_branch_exists "$ORIGIN/$BASE_BRANCH"; then 365 | require_branches_equal "$BASE_BRANCH" "$ORIGIN/$BASE_BRANCH" 366 | fi 367 | 368 | run_pre_hook "$NAME" "$ORIGIN" "$BRANCH" 369 | 370 | # If the user wants to rebase, do that first 371 | if flag rebase; then 372 | local _rebase_opts="" 373 | if flag preserve_merges; then 374 | _rebase_opts="$_rebase_opts -p" 375 | fi 376 | if flag showcommands; then 377 | _rebase_opts="$_rebase_opts --showcommands" 378 | fi 379 | if ! git flow bugfix rebase $_rebase_opts "$NAME"; then 380 | warn "Finish was aborted due to conflicts during rebase." 381 | warn "Please finish the rebase manually now." 382 | warn "When finished, re-run:" 383 | warn " git flow bugfix finish '$NAME' '$BASE_BRANCH'" 384 | exit 1 385 | fi 386 | fi 387 | 388 | # Merge into BASE 389 | git_do checkout "$BASE_BRANCH" || die "Could not check out branch '$BASE_BRANCH'." 390 | 391 | if noflag squash; then 392 | if flag no_ff; then 393 | git_do merge --no-ff "$BRANCH" 394 | else 395 | if [ "$(git rev-list -n2 "$BASE_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then 396 | git_do merge --ff "$BRANCH" 397 | else 398 | git_do merge --no-ff "$BRANCH" 399 | fi 400 | fi 401 | else 402 | git_do merge --squash "$BRANCH" 403 | flag squash_info && gitflow_create_squash_message "Merged bugfix branch '$BRANCH'" "$BASE_BRANCH" "$BRANCH" > "$DOT_GIT_DIR/SQUASH_MSG" 404 | git_do commit 405 | fi 406 | 407 | if [ $? -ne 0 ]; then 408 | # Oops.. we have a merge conflict! 409 | # Write the given $BASE_BRANCH to a temporary file as we will 410 | # be needing it later. 411 | mkdir -p "$DOT_GIT_DIR/.gitflow" 412 | echo "$BASE_BRANCH" > "$DOT_GIT_DIR/.gitflow/MERGE_BASE" 413 | echo 414 | echo "There were merge conflicts. To resolve the merge conflict manually, use:" 415 | echo " git mergetool" 416 | echo " git commit" 417 | echo 418 | echo "You can then complete the finish by running it again:" 419 | echo " git flow bugfix finish $NAME" 420 | echo 421 | exit 1 422 | fi 423 | 424 | run_post_hook "$NAME" "$ORIGIN" "$BRANCH" 425 | 426 | # When no merge conflict is detected, just clean up the bugfix branch 427 | gitflow_config_remove_base_branch "$BRANCH" 428 | helper_finish_cleanup 429 | } 430 | 431 | helper_finish_cleanup() { 432 | local keepmsg remotebranchdeleted localbranchdeleted 433 | 434 | # Sanity checks 435 | require_branch "$BRANCH" 436 | require_clean_working_tree 437 | 438 | remotebranchdeleted=$FLAGS_FALSE 439 | localbranchdeleted=$FLAGS_FALSE 440 | 441 | if flag push; then 442 | git_do push "$ORIGIN" "$BASE_BRANCH" || die "Could not push branch '$BASE_BRANCH' to remote '$ORIGIN'." 443 | fi 444 | 445 | if noflag keep; then 446 | 447 | # Always delete remote first 448 | if noflag keepremote;then 449 | if git_remote_branch_exists "$ORIGIN/$BRANCH"; then 450 | git_remote_branch_delete "$BRANCH" && remotebranchdeleted=$FLAGS_TRUE 451 | fi 452 | fi 453 | 454 | # Delete local after remote to avoid warnings 455 | if noflag keeplocal; then 456 | if [ "$BRANCH" = "$(git_current_branch)" ]; then 457 | git_do checkout "$BASE_BRANCH" || die "Could not check out branch '$BASE_BRANCH'." 458 | fi 459 | if flag force_delete; then 460 | git_do branch -D "$BRANCH" && localbranchdeleted=$FLAGS_TRUE 461 | else 462 | if noflag squash; then 463 | git_do branch -d "$BRANCH" && localbranchdeleted=$FLAGS_TRUE 464 | else 465 | git_do branch -D "$BRANCH" && localbranchdeleted=$FLAGS_TRUE 466 | fi 467 | fi 468 | fi 469 | 470 | # no more branches: we can safely remove config section 471 | if ! git_remote_branch_exists "$ORIGIN/$BRANCH" -a ! git_local_branch_exists "$BRANCH"; then 472 | gitflow_config_remove_base_section "$BRANCH" 473 | fi 474 | fi 475 | 476 | echo 477 | echo "Summary of actions:" 478 | echo "- The bugfix branch '$BRANCH' was merged into '$BASE_BRANCH'" 479 | #echo "- Merge conflicts were resolved" # TODO: Add this line when it's supported 480 | if noflag keep; then 481 | if [ $localbranchdeleted -eq $FLAGS_TRUE ]; then 482 | keepmsg="has been locally deleted" 483 | else 484 | keepmsg="is still locally available" 485 | fi 486 | if [ $remotebranchdeleted -eq $FLAGS_TRUE ]; then 487 | keepmsg=$keepmsg"; it has been remotely deleted from '$ORIGIN'" 488 | elif git_remote_branch_exists "$ORIGIN/$BRANCH"; then 489 | keepmsg=$keepmsg"; it is still remotely available on '$ORIGIN'" 490 | fi 491 | else 492 | keepmsg="is still locally available" 493 | if git_remote_branch_exists "$ORIGIN/$BRANCH"; then 494 | keepmsg=$keepmsg"; it is still remotely available on '$ORIGIN'" 495 | fi 496 | fi 497 | echo "- bugfix branch '$BRANCH' "$keepmsg 498 | echo "- You are now on branch '$(git_current_branch)'" 499 | echo 500 | } 501 | 502 | cmd_publish() { 503 | OPTIONS_SPEC="\ 504 | git flow bugfix publish [-h] [] 505 | 506 | Publish bugfix branch on $ORIGIN. 507 | When is omitted the current branch is used, but only if it's a bugfix branch. 508 | -- 509 | h,help! Show this help 510 | showcommands! Show git commands while executing them 511 | " 512 | # Parse arguments 513 | parse_args "$@" 514 | 515 | # Use current branch if no name is given 516 | if [ "$NAME" = "" ]; then 517 | gitflow_use_current_branch_name 518 | fi 519 | 520 | 521 | # Sanity checks 522 | require_clean_working_tree 523 | require_branch "$BRANCH" 524 | git_do fetch -q "$ORIGIN" || die "Could not fetch branch '$BRANCH' from remote '$ORIGIN'." 525 | require_branch_absent "$ORIGIN/$BRANCH" 526 | 527 | run_pre_hook "$NAME" "$ORIGIN" "$BRANCH" 528 | 529 | # Create remote branch with remote tracking 530 | git_do push -u "$ORIGIN" "$BRANCH:$BRANCH" 531 | git_do fetch -q "$ORIGIN" "$BRANCH" || die "Could not fetch branch '$BRANCH' from remote '$ORIGIN'." 532 | git_do checkout "$BRANCH" || die "Could not check out branch '$BRANCH'." 533 | 534 | run_post_hook "$NAME" "$ORIGIN" "$BRANCH" 535 | 536 | echo 537 | echo "Summary of actions:" 538 | echo "- The remote branch '$BRANCH' was created or updated" 539 | echo "- The local branch '$BRANCH' was configured to track the remote branch" 540 | echo "- You are now on branch '$(git_current_branch)'" 541 | echo 542 | } 543 | 544 | cmd_track() { 545 | OPTIONS_SPEC="\ 546 | git flow bugfix track [-h] 547 | 548 | Start tracking bugfix that is shared on $ORIGIN 549 | -- 550 | h,help! Show this help 551 | showcommands! Show git commands while executing them 552 | " 553 | # Parse arguments 554 | parse_args "$@" 555 | 556 | gitflow_require_name_arg 557 | 558 | # Sanity checks 559 | require_clean_working_tree 560 | require_local_branch_absent "$BRANCH" 561 | 562 | run_pre_hook "$NAME" "$ORIGIN" "$BRANCH" 563 | 564 | git_do fetch -q "$ORIGIN" || die "Could not fetch branch '$BRANCH' from remote '$ORIGIN'." 565 | git_remote_branch_exists "$ORIGIN/$BRANCH" 566 | 567 | # Create tracking branch 568 | git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH" || die "Could not create '$BRANCH'." 569 | 570 | run_post_hook "$NAME" "$ORIGIN" "$BRANCH" 571 | 572 | echo 573 | echo "Summary of actions:" 574 | echo "- A new remote tracking branch '$BRANCH' was created" 575 | echo "- You are now on branch '$(git_current_branch)'" 576 | echo 577 | } 578 | 579 | cmd_diff() { 580 | OPTIONS_SPEC="\ 581 | git flow bugfix diff [-h] [] 582 | 583 | Show all changes in that are not in the base 584 | -- 585 | h,help! Show this help 586 | showcommands! Show git commands while executing them 587 | " 588 | local base 589 | 590 | # Parse arguments 591 | parse_args "$@" 592 | 593 | # Use current branch if no name is given 594 | if [ "$NAME" = "" ]; then 595 | gitflow_use_current_branch_name 596 | fi 597 | 598 | base=$(gitflow_config_get_base_branch $BRANCH) 599 | base=${base:-$DEVELOP_BRANCH} 600 | 601 | git_do diff "$base...$BRANCH" 602 | } 603 | 604 | cmd_checkout() { 605 | OPTIONS_SPEC="\ 606 | git flow bugfix checkout [-h] [] 607 | 608 | Switch to bugfix branch 609 | -- 610 | h,help! Show this help 611 | showcommands! Show git commands while executing them 612 | " 613 | # Parse arguments 614 | parse_args "$@" 615 | 616 | NAME=$(gitflow_resolve_nameprefix "$NAME" "$PREFIX") 617 | if [ $? -eq 0 ]; then 618 | BRANCH=$PREFIX$NAME 619 | git_do checkout "$BRANCH" || die "Could not check out branch '$BRANCH'." 620 | fi 621 | } 622 | 623 | cmd_co() { 624 | # Alias for checkout 625 | cmd_checkout "$@" 626 | } 627 | 628 | cmd_rebase() { 629 | OPTIONS_SPEC="\ 630 | git flow bugfix rebase [-h] [-i] [-p] [] 631 | 632 | Rebase on 633 | -- 634 | h,help! Show this help 635 | showcommands! Show git commands while executing them 636 | i,[no]interactive Do an interactive rebase 637 | p,[no]preserve-merges Preserve merges 638 | " 639 | local opts 640 | 641 | # Define flags 642 | DEFINE_boolean 'interactive' false 'do an interactive rebase' i 643 | DEFINE_boolean 'preserve-merges' false 'try to recreate merges' p 644 | 645 | # Override defaults with values from config 646 | gitflow_override_flag_boolean "bugfix.rebase.interactive" "interactive" 647 | gitflow_override_flag_boolean "bugfix.rebase.preserve-merges" "preserve_merges" 648 | 649 | # Parse arguments 650 | parse_args "$@" 651 | 652 | # Use current branch if no name is given 653 | if [ "$NAME" = "" ]; then 654 | gitflow_use_current_branch_name 655 | fi 656 | 657 | 658 | BASE_BRANCH=$(gitflow_config_get_base_branch $BRANCH) 659 | BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH} 660 | 661 | warn "Will try to rebase '$NAME' which is based on '$BASE_BRANCH'..." 662 | if ! git_config_bool_exists "rebase.autostash"; then 663 | require_clean_working_tree 664 | fi 665 | require_branch "$BRANCH" 666 | 667 | git_local_branch_exists "$BASE_BRANCH" || die "The base '$BASE_BRANCH' doesn't exists locally or is not a branch. Can't rebase the bugfix branch '$BRANCH'." 668 | 669 | git_do checkout -q "$BRANCH" || die "Could not check out branch '$BRANCH'." 670 | if flag interactive; then 671 | opts="$opts -i" 672 | fi 673 | if flag preserve_merges; then 674 | opts="$opts -p" 675 | fi 676 | git_do rebase $opts "$BASE_BRANCH" 677 | } 678 | 679 | avoid_accidental_cross_branch_action() { 680 | local current_branch 681 | 682 | current_branch=$(git_current_branch) 683 | if [ "$BRANCH" != "$current_branch" ]; then 684 | warn "Trying to pull from '$BRANCH' while currently on branch '$current_branch'." 685 | warn "To avoid unintended merges, git-flow aborted." 686 | return 1 687 | fi 688 | return 0 689 | } 690 | 691 | cmd_pull() { 692 | OPTIONS_SPEC="\ 693 | git flow bugfix pull [-h] [] 694 | 695 | Pull bugfix from 696 | -- 697 | h,help! Show this help 698 | showcommands! Show git commands while executing them 699 | " 700 | local current_branch 701 | 702 | # Define flags 703 | DEFINE_boolean 'rebase' false "pull with rebase" r 704 | 705 | warn "The command 'git flow bugfix pull' will be deprecated per version 2.0.0. Use 'git flow bugfix track' instead." 706 | 707 | # Parse arguments 708 | parse_remote_name "$@" 709 | 710 | if [ -z "$REMOTE" ]; then 711 | die "Name a remote explicitly." 712 | fi 713 | 714 | # Use current branch if no name is given 715 | if [ "$NAME" = "" ]; then 716 | gitflow_use_current_branch_name 717 | fi 718 | 719 | # To avoid accidentally merging different bugfix branches into each other, 720 | # die if the current bugfix branch differs from the requested $NAME 721 | # argument. 722 | current_branch=$(git_current_branch) 723 | if startswith "$current_branch" "$PREFIX"; then 724 | # We are on a local bugfix branch already, so $BRANCH must be equal to 725 | # the current branch 726 | avoid_accidental_cross_branch_action || die 727 | fi 728 | 729 | require_clean_working_tree 730 | 731 | run_pre_hook "$NAME" "$REMOTE" "$BRANCH" 732 | 733 | if git_local_branch_exists "$BRANCH"; then 734 | # Again, avoid accidental merges 735 | avoid_accidental_cross_branch_action || die 736 | 737 | # We already have a local branch called like this, so simply pull the 738 | # remote changes in 739 | if flag rebase; then 740 | if ! git_do pull --rebase -q "$REMOTE" "$BRANCH"; then 741 | warn "Pull was aborted. There might be conflicts during rebase or '$REMOTE' might be inaccessible." 742 | exit 1 743 | fi 744 | else 745 | git_do pull -q "$REMOTE" "$BRANCH" || die "Failed to pull from remote '$REMOTE'." 746 | fi 747 | 748 | echo "Pulled $REMOTE's changes into $BRANCH." 749 | else 750 | # Setup the local branch clone for the first time 751 | git_do fetch -q "$REMOTE" "$BRANCH" || die "Could not fetch branch '$BRANCH' from remote '$REMOTE'." # Stores in FETCH_HEAD 752 | git_do branch --no-track "$BRANCH" FETCH_HEAD || die "Branch failed." 753 | git_do checkout -q "$BRANCH" || die "Could not check out branch '$BRANCH'." 754 | echo "Created local branch $BRANCH based on $REMOTE's $BRANCH." 755 | fi 756 | 757 | run_post_hook "$NAME" "$REMOTE" "$BRANCH" 758 | } 759 | 760 | cmd_delete() { 761 | OPTIONS_SPEC="\ 762 | git flow bugfix delete [-h] [-f] [-r] 763 | 764 | Delete a given bugfix branch 765 | -- 766 | h,help! Show this help 767 | showcommands! Show git commands while executing them 768 | f,[no]force Force deletion 769 | r,[no]remote Delete remote branch 770 | " 771 | local current_branch 772 | 773 | # Define flags 774 | DEFINE_boolean 'force' false "force deletion" f 775 | DEFINE_boolean 'remote' false "delete remote branch" r 776 | 777 | # Override defaults with values from config 778 | gitflow_override_flag_boolean "bugfix.delete.force" "force" 779 | gitflow_override_flag_boolean "bugfix.delete.remote" "remote" 780 | 781 | # Parse arguments 782 | parse_args "$@" 783 | 784 | gitflow_require_name_arg 785 | 786 | # Sanity checks 787 | require_branch "$BRANCH" 788 | 789 | BASE_BRANCH=$(gitflow_config_get_base_branch $BRANCH) 790 | BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH} 791 | 792 | run_pre_hook "$NAME" "$ORIGIN" "$BRANCH" 793 | 794 | current_branch=$(git_current_branch) 795 | # We can't delete a branch we are on, switch to the develop branch. 796 | if [ "$BRANCH" = "$current_branch" ]; then 797 | require_clean_working_tree 798 | if git_local_branch_exists "$BASE_BRANCH"; then 799 | git_do checkout "$BASE_BRANCH" 800 | else 801 | git_do checkout "$DEVELOP_BRANCH" || die "Could not check out branch '$DEVELOP_BRANCH'." 802 | fi 803 | fi 804 | 805 | if git_is_branch_merged_into "$BRANCH" "$BASE_BRANCH"; then 806 | git_do branch -d "$BRANCH" || die "Could not delete the $BRANCH." 807 | if flag remote; then 808 | git_remote_branch_delete "$BRANCH" 809 | fi 810 | else 811 | if flag force; then 812 | git_do branch -D "$BRANCH" || die "Could not delete the $BRANCH." 813 | if flag remote; then 814 | git_remote_branch_delete "$BRANCH" 815 | fi 816 | else 817 | die "bugfix branch '$BRANCH' has been not been merged yet. Use -f to force the deletion." 818 | fi 819 | fi 820 | 821 | gitflow_config_remove_base_section "$BRANCH" 822 | run_post_hook "$NAME" "$ORIGIN" "$BRANCH" 823 | 824 | echo 825 | echo "Summary of actions:" 826 | echo "- bugfix branch '$BRANCH' has been deleted." 827 | flag remote && echo "- bugfix branch '$BRANCH' in '$ORIGIN' has been deleted." 828 | echo "- You are now on branch '$(git_current_branch)'" 829 | echo 830 | } 831 | 832 | cmd_rename() { 833 | OPTIONS_SPEC="\ 834 | git flow bugfix rename [] 835 | 836 | Rename a given bugfix branch 837 | -- 838 | h,help! Show this help 839 | showcommands! Show git commands while executing them 840 | " 841 | gitflow_rename_branch "$@" 842 | } 843 | -------------------------------------------------------------------------------- /git-flow-config: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # vim:et:ft=sh:sts=2:sw=2 3 | # 4 | # git-flow -- A collection of Git extensions to provide high-level 5 | # repository operations for Vincent Driessen's branching model. 6 | # 7 | # A blog post presenting this model is found at: 8 | # http://blog.avirtualhome.com/development-workflow-using-git/ 9 | # 10 | # Feel free to contribute to this project at: 11 | # http://github.com/petervanderdoes/gitflow 12 | # 13 | # Authors: 14 | # Copyright 2012-2019 Peter van der Does. All rights reserved. 15 | # 16 | # 17 | # Redistribution and use in source and binary forms, with or without 18 | # modification, are permitted provided that the following conditions are met: 19 | # 20 | # 1. Redistributions of source code must retain the above copyright notice, this 21 | # list of conditions and the following disclaimer. 22 | # 2. Redistributions in binary form must reproduce the above copyright notice, 23 | # this list of conditions and the following disclaimer in the documentation 24 | # and/or other materials provided with the distribution. 25 | # 26 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 27 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 30 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | # 37 | 38 | 39 | initialize() { 40 | require_git_repo 41 | require_gitflow_initialized 42 | gitflow_load_settings 43 | } 44 | 45 | usage() { 46 | OPTIONS_SPEC="\ 47 | git flow config [list] 48 | git flow config set 49 | git flow config base 50 | 51 | Manage the git-flow configuration. 52 | 53 | For more specific help type the command followed by --help 54 | -- 55 | " 56 | flags_help 57 | } 58 | 59 | parse_args() { 60 | # Parse options 61 | FLAGS "$@" || exit $? 62 | eval set -- "${FLAGS_ARGV}" 63 | 64 | OPTION=$(echo $1|tr '[:upper:]' '[:lower:]') 65 | 66 | if [ "$FLAGS_file" != "" ]; then 67 | gitflow_config_option="--file '$FLAGS_file'" 68 | elif flag local; then 69 | gitflow_config_option="--local" 70 | elif flag global; then 71 | gitflow_config_option="--global" 72 | elif flag system; then 73 | gitflow_config_option="--system" 74 | else 75 | gitflow_config_option="" 76 | fi 77 | 78 | } 79 | 80 | # Default entry when no SUBACTION is given 81 | cmd_default() { 82 | cmd_list "$@" 83 | } 84 | 85 | cmd_list() { 86 | OPTIONS_SPEC="\ 87 | git flow config [list] 88 | 89 | Show the git-flow configurations 90 | -- 91 | h,help! Show this help 92 | 93 | Use config file location 94 | local! Use repository config file 95 | global! Use global config file 96 | system! Use system config file 97 | file= Use given config file 98 | " 99 | local output 100 | 101 | # Define flags 102 | DEFINE_boolean 'local' false 'use repository config file' 103 | DEFINE_boolean 'global' false 'use global config file' 104 | DEFINE_boolean 'system' false 'use system config file' 105 | DEFINE_string 'file' "" 'use given config file' 106 | 107 | # Parse arguments 108 | parse_args "$@" 109 | 110 | output=$(git config $gitflow_config_option --get gitflow.branch.master) 111 | echo "Branch name for production releases: $output " 112 | 113 | output=$(git config $gitflow_config_option --get gitflow.branch.develop) 114 | echo "Branch name for \"next release\" development: $output " 115 | 116 | output=$(git config $gitflow_config_option --get gitflow.prefix.feature) 117 | echo "Feature branch prefix: $output " 118 | 119 | output=$(git config $gitflow_config_option --get gitflow.prefix.bugfix) 120 | echo "Bugfix branch prefix: $output " 121 | 122 | output=$(git config $gitflow_config_option --get gitflow.prefix.release) 123 | echo "Release branch prefix: $output " 124 | 125 | output=$(git config $gitflow_config_option --get gitflow.prefix.hotfix) 126 | echo "Hotfix branch prefix: $output " 127 | 128 | output=$(git config $gitflow_config_option --get gitflow.prefix.support) 129 | echo "Support branch prefix: $output " 130 | 131 | output=$(git config $gitflow_config_option --get gitflow.prefix.versiontag) 132 | echo "Version tag prefix: $output " 133 | } 134 | 135 | cmd_set() { 136 | OPTIONS_SPEC="\ 137 | git flow config set