提交 298514b6 编写于 作者: V Vincent Driessen

Merge branch 'release/0.3'

Authors are (ordered by first commit date):
- Vincent Driessen
- Benedikt Böhm
- Daniel Truemper
- Jason L. Shiffer
- Randy Merrill
- Rick Osborne
- Mark Derricutt
Portions derived from other open source works are clearly marked.
0.3:
----
Release date: **2010/07/22**
* New subcommands for `git flow feature`:
- **checkout**:
For easily checking out features by their short name. Even allows
unique prefixes as arguments (see below).
- **pull**:
This subcommand allows you to painlessly work on a feature branch
together with another peer. This is especially valuable for doing
peer reviews of other people's code. For more detailed info, see the
[commit log][1].
* Easier addressing of branch names by using name prefixes.
For example, when using:
git flow feature finish fo
this automatically finishes the feature branch `foobar` if that's the only
feature branch name starting with `fo`.
* No force flag anymore for new feature branches
`git flow feature start` lost its `-f` (force) flag. You now don't
have to be in a clean repo anymore to start a new feature branch. This
avoids the manual `git stash`, `git flow feature start`, `git stash
pop` cycle.
* You can use `git-flow` in stand-alone repo's now.
This means it does not assume you have an `origin` repository.
(Thanks [Mark][2].)
* No commands fetch from `origin` by default anymore.
There were some issues related to disabling this flag on some platforms.
* Init guesses branch names you may want to use for `develop` and `master`.
* Added super-easy installation script. (Thanks [Rick][3].)
* Added BSD license.
[1]: http://github.com/nvie/gitflow/commit/f68d405cc3a11e9df3671f567658a6ab6ed8e0a1
[2]: http://github.com/talios
[3]: http://github.com/rickosborne
Older versions
--------------
No change history is recorded for pre-0.3 releases.
Copyright 2010 Vincent Driessen. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Vincent Driessen.
#
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
prefix=/usr/local
# files that need mode 755
......
......@@ -5,13 +5,14 @@ for Vincent Driessen's [branching model](http://nvie.com/git-model "original
blog post").
> **IMPORTANT NOTE:**
> In release 0.2, the order of the arguments has changed to provide a logical
> subcommand hierarchy.
Installing git-flow
-------------------
The easiest way to install git-flow is using Rick Osborne's excellent
git-flow installer, which can be run using the following command:
$ wget -q -O - http://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo sh
If you prefer a manual installation, please use the following instructions.
After downloading the sources from Github, also fetch the submodules:
$ git submodule init
......@@ -30,6 +31,21 @@ Or simply point your `PATH` environment variable to your git-flow checkout
directory.
Integration with your shell
---------------------------
For those who use the [Bash](http://www.gnu.org/software/bash/) shell, please
check out the excellent work on the
[git-flow-completion](http://github.com/bobthecow/git-flow-completion) project
by [bobthecow](http://github.com/bobthecow). It offers tab-completion for all
git-flow subcommands and branch names.
If you are a [zsh](http://www.zsh.org) user with some plugin-writing
experience, please help us develop a
[completion plugin](http://github.com/bobthecow/git-flow-completion/issues#issue/1)
for zsh, too. Please contact me on [Github](http://github.com/inbox/new/nvie)
or [Twitter](http://twitter.com/nvie) to discuss details.
Please help out
---------------
This project is still under development. Feedback and suggestions are very
......@@ -37,7 +53,20 @@ welcome and I encourage you to use the [Issues
list](http://github.com/nvie/gitflow/issues) on Github to provide that
feedback.
Feel free to fork this repo and to commit your additions.
Feel free to fork this repo and to commit your additions. For a list of all
contributors, please see the [AUTHORS](AUTHORS) file.
Any questions, tips, or general discussion can be posted to our Google group:
http://groups.google.com/group/gitflow-users
License terms
-------------
git-flow is published under the liberal terms of the BSD License, see the
[LICENSE](LICENSE) file. Although the BSD License does not require you to share
any modifications you make to the source code, you are very much encouraged and
invited to contribute back your modifications to the community, preferably
in a Github fork, of course.
Typical usage:
......
#!/bin/sh
# git-flow make-less installer for *nix systems, by Rick Osborne
# Based on the git-flow core Makefile:
# http://github.com/nvie/gitflow/blob/master/Makefile
# Licensed under the same restrictions as git-flow:
# http://github.com/nvie/gitflow/blob/develop/LICENSE
# Does this need to be smarter for each host OS?
if [ -z "$INSTALL_PREFIX" ] ; then
INSTALL_PREFIX="/usr/local/bin"
fi
if [ -z "$REPO_NAME" ] ; then
REPO_NAME="gitflow"
fi
if [ -z "$REPO_HOME" ] ; then
REPO_HOME="http://github.com/nvie/gitflow.git"
fi
EXEC_FILES="git-flow"
SCRIPT_FILES="git-flow-init git-flow-feature git-flow-hotfix git-flow-release git-flow-support git-flow-version gitflow-common gitflow-shFlags"
SUBMODULE_FILE="gitflow-shFlags"
echo "### gitflow no-make installer ###"
case "$1" in
uninstall)
echo "Uninstalling git-flow from $INSTALL_PREFIX"
if [ -d "$INSTALL_PREFIX" ] ; then
for script_file in $SCRIPT_FILES $EXEC_FILES ; do
echo "rm -vf $INSTALL_PREFIX/$script_file"
rm -vf "$INSTALL_PREFIX/$script_file"
done
else
echo "The '$INSTALL_PREFIX' directory was not found."
echo "Do you need to set INSTALL_PREFIX ?"
fi
exit
;;
help)
echo "Usage: [environment] gitflow-installer.sh [install|uninstall]"
echo "Environment:"
echo " INSTALL_PREFIX=$INSTALL_PREFIX"
echo " REPO_HOME=$REPO_HOME"
echo " REPO_NAME=$REPO_NAME"
exit
;;
*)
echo "Installing git-flow to $INSTALL_PREFIX"
if [[ -d "$REPO_NAME" && -d "$REPO_NAME/.git" ]] ; then
echo "Using existing repo: $REPO_NAME"
else
echo "Cloning repo from GitHub to $REPO_NAME"
git clone "$REPO_HOME" "$REPO_NAME"
fi
if [ -f "$REPO_NAME/$SUBMODULE_FILE" ] ; then
echo "Submodules look up to date"
else
echo "Updating submodules"
lastcwd=$PWD
cd "$REPO_NAME"
git submodule init
git submodule update
cd "$lastcwd"
fi
install -v -d -m 0755 "$INSTALL_PREFIX"
for exec_file in $EXEC_FILES ; do
install -v -m 0755 "$REPO_NAME/$exec_file" "$INSTALL_PREFIX"
done
for script_file in $SCRIPT_FILES ; do
install -v -m 0644 "$REPO_NAME/$script_file" "$INSTALL_PREFIX"
done
exit
;;
esac
......@@ -4,13 +4,37 @@
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/archives/323
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright (c) 2010 by Benedikt Böhm
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
# enable debug mode
......@@ -78,11 +102,4 @@ main() {
cmd_$SUBACTION "$@"
}
# helper functions for common reuse
max() { if [ "$1" -gt "$2" ]; then echo "$1"; else echo "$2"; fi; }
# convenience functions for checking whether flags have been set or not
flag() { eval FLAG=\$FLAGS_$1; [ $FLAG -eq $FLAGS_TRUE ]; }
noflag() { eval FLAG=\$FLAGS_$1; [ $FLAG -ne $FLAGS_TRUE ]; }
main "$@"
......@@ -3,13 +3,37 @@
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/archives/323
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright (c) 2010 by Benedikt Böhm
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
require_git_repo
......@@ -19,12 +43,14 @@ PREFIX=$(git config --get gitflow.prefix.feature)
usage() {
echo "usage: git flow feature [list] [-v]"
echo " git flow feature start [-Ff] <name> [<base>]"
echo " git flow feature start [-F] <name> [<base>]"
echo " git flow feature finish [-rF] <name|nameprefix>"
echo " git flow feature publish <name>"
echo " git flow feature track <name>"
echo " git flow feature diff [<name|nameprefix>]"
echo " git flow feature rebase [-i] [<name|nameprefix>]"
echo " git flow feature checkout [<name|nameprefix>]"
echo " git flow feature pull <remote> [<name>]"
}
cmd_default() {
......@@ -41,6 +67,11 @@ cmd_list() {
feature_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
if [ -z "$feature_branches" ]; then
warn "No feature branches exist."
warn ""
warn "You can start a new feature branch:"
warn ""
warn " git flow feature start <name> [<base>]"
warn ""
exit 0
fi
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
......@@ -112,45 +143,63 @@ expand_nameprefix_arg() {
esac
}
use_current_feature_branch_name() {
local current_branch=$(git_current_branch)
if startswith "$current_branch" "$PREFIX"; then
BRANCH=$current_branch
NAME=${BRANCH#$PREFIX}
else
warn "The current HEAD is no feature branch."
warn "Please specify a <name> argument."
exit 1
fi
}
expand_nameprefix_arg_or_current() {
if [ "$NAME" != "" ]; then
expand_nameprefix_arg
require_branch "$PREFIX$NAME"
else
local current_branch=$(git_current_branch)
if startswith "$current_branch" "$PREFIX"; then
BRANCH=$current_branch
NAME=${BRANCH#$PREFIX}
else
warn "The current HEAD is no feature branch."
warn "To diff a feature, specify a <name> argument."
usage
exit 1
fi
use_current_feature_branch_name
fi
}
parse_args() {
name_or_current() {
if [ -z "$NAME" ]; then
use_current_feature_branch_name
fi
}
parse_cmdline() {
# parse options
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
}
parse_args() {
parse_cmdline "$@"
# read arguments into global variables
NAME=$1
BRANCH=$PREFIX$NAME
}
parse_remote_name() {
parse_cmdline "$@"
# read arguments into global variables
REMOTE=$1
NAME=$2
BRANCH=$PREFIX$NAME
}
cmd_start() {
DEFINE_boolean fetch false 'fetch from origin before performing local operation' F
DEFINE_boolean force false 'force creation of feature branch (ignores dirty working tree)' f
parse_args "$@"
BASE=${2:-$DEVELOP_BRANCH}
require_name_arg
# sanity checks
if noflag force; then
require_clean_working_tree
fi
require_branch_absent "$BRANCH"
# update the local repo with remote changes, if asked
......@@ -158,7 +207,11 @@ cmd_start() {
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
# if the origin branch counterpart exists, assert that the local branch
# isn't behind it (to avoid unnecessary rebasing)
if git_branch_exists "$ORIGIN/$DEVELOP_BRANCH"; then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# create branch
if ! git checkout -b "$BRANCH" "$BASE"; then
......@@ -172,7 +225,7 @@ cmd_start() {
echo ""
echo "Now, start committing on your feature. When done, use:"
echo ""
echo " git flow finish feature $NAME"
echo " git flow feature finish $NAME"
echo
}
......@@ -229,14 +282,18 @@ cmd_finish() {
require_clean_working_tree
# update local repo with remote changes first, if asked
if flag fetch; then
git fetch -q "$ORIGIN" "$BRANCH"
if has "$ORIGIN/$BRANCH" "$(git_remote_branches)"; then
if flag fetch; then
git fetch -q "$ORIGIN" "$BRANCH"
fi
fi
if has "$ORIGIN/$BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$BRANCH" "$ORIGIN/$BRANCH"
fi
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
if has "$ORIGIN/$DEVELOP_BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# if the user wants to rebase, do that first
if flag rebase; then
......@@ -286,7 +343,7 @@ helper_finish_cleanup() {
if flag fetch; then
git push "$ORIGIN" ":refs/heads/$BRANCH"
fi
git branch -d "$BRANCH"
git branch -D "$BRANCH"
echo
echo "Summary of actions:"
......@@ -361,6 +418,22 @@ cmd_diff() {
fi
}
cmd_checkout() {
parse_args "$@"
if [ "$NAME" != "" ]; then
expand_nameprefix_arg
git checkout "$BRANCH"
else
die "Name a feature branch explicitly."
fi
}
cmd_co() {
# Alias for checkout
cmd_checkout "$@"
}
cmd_rebase() {
DEFINE_boolean interactive false 'do an interactive rebase' i
parse_args "$@"
......@@ -376,3 +449,51 @@ cmd_rebase() {
fi
git rebase $OPTS "$DEVELOP_BRANCH"
}
avoid_accidental_cross_branch_action() {
local current_branch=$(git_current_branch)
if [ "$BRANCH" != "$current_branch" ]; then
warn "Trying to pull from '$BRANCH' while currently on branch '$current_branch'."
warn "To avoid unintended merges, git-flow aborted."
return 1
fi
return 0
}
cmd_pull() {
#DEFINE_string prefix false 'alternative remote feature branch name prefix' p
parse_remote_name "$@"
if [ -z "$REMOTE" ]; then
die "Name a remote explicitly."
fi
name_or_current
# To avoid accidentally merging different feature branches into each other,
# die if the current feature branch differs from the requested $NAME
# argument.
local current_branch=$(git_current_branch)
if startswith "$current_branch" "$PREFIX"; then
# we are on a local feature branch already, so $BRANCH must be equal to
# the current branch
avoid_accidental_cross_branch_action || die
fi
require_clean_working_tree
if git_branch_exists "$BRANCH"; then
# Again, avoid accidental merges
avoid_accidental_cross_branch_action || die
# we already have a local branch called like this, so simply pull the
# remote changes in
git pull -q "$REMOTE" "$BRANCH" || die "Failed to pull from remote '$REMOTE'."
echo "Pulled $REMOTE's changes into $BRANCH."
else
# setup the local branch clone for the first time
git fetch -q "$REMOTE" "$BRANCH" || die "Fetch failed." # stores in FETCH_HEAD
git branch --no-track "$BRANCH" FETCH_HEAD || die "Branch failed."
git checkout -q "$BRANCH" || die "Checking out new local branch failed."
echo "Created local branch $BRANCH based on $REMOTE's $BRANCH."
fi
}
......@@ -3,13 +3,37 @@
# repository operations for Vincent Driessen's branching model.
#
# Original blog post presenting this model is found at:
# http://nvie.com/archives/323
# http://nvie.com/git-model
#
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright (c) 2010 by Benedikt Böhm
# Copyright 2010 Vincent Driessen. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen.
#
require_git_repo
......@@ -38,6 +62,11 @@ cmd_list() {
hotfix_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
if [ -z "$hotfix_branches" ]; then
warn "No hotfix branches exist."
warn ""
warn "You can start a new hotfix branch:"
warn ""
warn " git flow hotfix start <name> [<base>]"
warn ""
exit 0
fi
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
......@@ -124,7 +153,7 @@ require_no_existing_hotfix_branches() {
}
cmd_start() {
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
parse_args "$@"
BASE=${2:-$MASTER_BRANCH}
require_version_arg
......@@ -138,7 +167,9 @@ cmd_start() {
if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH"
fi
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi
# create branch
git checkout -b "$BRANCH" "$BASE"
......@@ -158,7 +189,7 @@ cmd_start() {
}
cmd_finish() {
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
DEFINE_boolean sign false "sign the release tag cryptographically" s
DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
DEFINE_string message "" "use the given tag message" m
......@@ -180,8 +211,12 @@ cmd_finish() {
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi
if has "$ORIGIN/$DEVELOP_BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# try to merge into master