Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitflow
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tools
gitflow
Commits
298514b6
Commit
298514b6
authored
Jul 22, 2010
by
Vincent Driessen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/0.3'
parents
f8ea3eba
7c4cc659
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
627 additions
and
86 deletions
+627
-86
AUTHORS
AUTHORS
+11
-0
Changes.mdown
Changes.mdown
+50
-0
LICENSE
LICENSE
+26
-0
Makefile
Makefile
+28
-0
README.mdown
README.mdown
+35
-6
gitflow-installer.sh
contrib/gitflow-installer.sh
+78
-0
git-flow
git-flow
+27
-10
git-flow-feature
git-flow-feature
+146
-25
git-flow-hotfix
git-flow-hotfix
+43
-8
git-flow-init
git-flow-init
+50
-17
git-flow-release
git-flow-release
+43
-8
git-flow-support
git-flow-support
+33
-4
git-flow-version
git-flow-version
+29
-4
gitflow-common
gitflow-common
+28
-4
No files found.
AUTHORS
0 → 100644
View file @
298514b6
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.
Changes.mdown
0 → 100644
View file @
298514b6
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.
LICENSE
0 → 100644
View file @
298514b6
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.
Makefile
View file @
298514b6
#
# 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
prefix
=
/usr/local
# files that need mode 755
# files that need mode 755
...
...
README.mdown
View file @
298514b6
...
@@ -5,13 +5,14 @@ for Vincent Driessen's [branching model](http://nvie.com/git-model "original
...
@@ -5,13 +5,14 @@ for Vincent Driessen's [branching model](http://nvie.com/git-model "original
blog post").
blog post").
> **IMPORTANT NOTE:**
> In release 0.2, the order of the arguments has changed to provide a logical
> subcommand hierarchy.
Installing git-flow
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:
After downloading the sources from Github, also fetch the submodules:
$ git submodule init
$ git submodule init
...
@@ -30,6 +31,21 @@ Or simply point your `PATH` environment variable to your git-flow checkout
...
@@ -30,6 +31,21 @@ Or simply point your `PATH` environment variable to your git-flow checkout
directory.
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
Please help out
---------------
---------------
This project is still under development. Feedback and suggestions are very
This project is still under development. Feedback and suggestions are very
...
@@ -37,7 +53,20 @@ welcome and I encourage you to use the [Issues
...
@@ -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
list](http://github.com/nvie/gitflow/issues) on Github to provide that
feedback.
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:
Typical usage:
...
...
contrib/gitflow-installer.sh
0 → 100644
View file @
298514b6
#!/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
git-flow
View file @
298514b6
...
@@ -4,13 +4,37 @@
...
@@ -4,13 +4,37 @@
# repository operations for Vincent Driessen's branching model.
# repository operations for Vincent Driessen's branching model.
#
#
# Original blog post presenting this model is found at:
# 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:
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
# http://github.com/nvie/gitflow
#
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright 2010 Vincent Driessen. All rights reserved.
# Copyright (c) 2010 by Benedikt Böhm
#
# 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
# enable debug mode
...
@@ -78,11 +102,4 @@ main() {
...
@@ -78,11 +102,4 @@ main() {
cmd_
$SUBACTION
"
$@
"
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
"
$@
"
main
"
$@
"
git-flow-feature
View file @
298514b6
...
@@ -3,13 +3,37 @@
...
@@ -3,13 +3,37 @@
# repository operations for Vincent Driessen's branching model.
# repository operations for Vincent Driessen's branching model.
#
#
# Original blog post presenting this model is found at:
# 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:
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
# http://github.com/nvie/gitflow
#
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright 2010 Vincent Driessen. All rights reserved.
# Copyright (c) 2010 by Benedikt Böhm
#
# 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
require_git_repo
...
@@ -19,12 +43,14 @@ PREFIX=$(git config --get gitflow.prefix.feature)
...
@@ -19,12 +43,14 @@ PREFIX=$(git config --get gitflow.prefix.feature)
usage() {
usage() {
echo "usage: git flow feature [list] [-v]"
echo "usage: git flow feature [list] [-v]"
echo " git flow feature start [-F
f
] <name> [<base>]"
echo " git flow feature start [-F] <name> [<base>]"
echo " git flow feature finish [-rF] <name|nameprefix>"
echo " git flow feature finish [-rF] <name|nameprefix>"
echo " git flow feature publish <name>"
echo " git flow feature publish <name>"
echo " git flow feature track <name>"
echo " git flow feature track <name>"
echo " git flow feature diff [<name|nameprefix>]"
echo " git flow feature diff [<name|nameprefix>]"
echo " git flow feature rebase [-i] [<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() {
cmd_default() {
...
@@ -41,6 +67,11 @@ cmd_list() {
...
@@ -41,6 +67,11 @@ cmd_list() {
feature_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
feature_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
if [ -z "$feature_branches" ]; then
if [ -z "$feature_branches" ]; then
warn "No feature branches exist."
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
exit 0
fi
fi
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
...
@@ -112,45 +143,63 @@ expand_nameprefix_arg() {
...
@@ -112,45 +143,63 @@ expand_nameprefix_arg() {
esac
esac
}
}
expand_nameprefix_arg_or_current() {
use_current_feature_branch_name() {
if [ "$NAME" != "" ]; then
expand_nameprefix_arg
require_branch "$PREFIX$NAME"
else
local current_branch=$(git_current_branch)
local current_branch=$(git_current_branch)
if startswith "$current_branch" "$PREFIX"; then
if startswith "$current_branch" "$PREFIX"; then
BRANCH=$current_branch
BRANCH=$current_branch
NAME=${BRANCH#$PREFIX}
NAME=${BRANCH#$PREFIX}
else
else
warn "The current HEAD is no feature branch."
warn "The current HEAD is no feature branch."
warn "To diff a feature, specify a <name> argument."
warn "Please specify a <name> argument."
usage
exit 1
exit 1
fi
fi
}
expand_nameprefix_arg_or_current() {
if [ "$NAME" != "" ]; then
expand_nameprefix_arg
require_branch "$PREFIX$NAME"
else
use_current_feature_branch_name
fi
fi
}
}
parse_args() {
name_or_current() {
if [ -z "$NAME" ]; then
use_current_feature_branch_name
fi
}
parse_cmdline() {
# parse options
# parse options
FLAGS "$@" || exit $?
FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}"
eval set -- "${FLAGS_ARGV}"
}
parse_args() {
parse_cmdline "$@"
# read arguments into global variables
# read arguments into global variables
NAME=$1
NAME=$1
BRANCH=$PREFIX$NAME
BRANCH=$PREFIX$NAME
}
}
parse_remote_name() {
parse_cmdline "$@"
# read arguments into global variables
REMOTE=$1
NAME=$2
BRANCH=$PREFIX$NAME
}
cmd_start() {
cmd_start() {
DEFINE_boolean fetch false 'fetch from origin before performing local operation' F
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 "$@"
parse_args "$@"
BASE=${2:-$DEVELOP_BRANCH}
BASE=${2:-$DEVELOP_BRANCH}
require_name_arg
require_name_arg
# sanity checks
# sanity checks
if noflag force; then
require_clean_working_tree
fi
require_branch_absent "$BRANCH"
require_branch_absent "$BRANCH"
# update the local repo with remote changes, if asked
# update the local repo with remote changes, if asked
...
@@ -158,7 +207,11 @@ cmd_start() {
...
@@ -158,7 +207,11 @@ cmd_start() {
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
fi
# 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"
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# create branch
# create branch
if ! git checkout -b "$BRANCH" "$BASE"; then
if ! git checkout -b "$BRANCH" "$BASE"; then
...
@@ -172,7 +225,7 @@ cmd_start() {
...
@@ -172,7 +225,7 @@ cmd_start() {
echo ""
echo ""
echo "Now, start committing on your feature. When done, use:"
echo "Now, start committing on your feature. When done, use:"
echo ""
echo ""
echo " git flow f
inish feature
$NAME"
echo " git flow f
eature finish
$NAME"
echo
echo
}
}
...
@@ -229,14 +282,18 @@ cmd_finish() {
...
@@ -229,14 +282,18 @@ cmd_finish() {
require_clean_working_tree
require_clean_working_tree
# update local repo with remote changes first, if asked
# update local repo with remote changes first, if asked
if has "$ORIGIN/$BRANCH" "$(git_remote_branches)"; then
if flag fetch; then
if flag fetch; then
git fetch -q "$ORIGIN" "$BRANCH"
git fetch -q "$ORIGIN" "$BRANCH"
fi
fi
fi
if has "$ORIGIN/$BRANCH" "$(git_remote_branches)"; then
if has "$ORIGIN/$BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$BRANCH" "$ORIGIN/$BRANCH"
require_branches_equal "$BRANCH" "$ORIGIN/$BRANCH"
fi
fi
if has "$ORIGIN/$DEVELOP_BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# if the user wants to rebase, do that first
# if the user wants to rebase, do that first
if flag rebase; then
if flag rebase; then
...
@@ -286,7 +343,7 @@ helper_finish_cleanup() {
...
@@ -286,7 +343,7 @@ helper_finish_cleanup() {
if flag fetch; then
if flag fetch; then
git push "$ORIGIN" ":refs/heads/$BRANCH"
git push "$ORIGIN" ":refs/heads/$BRANCH"
fi
fi
git branch -
d
"$BRANCH"
git branch -
D
"$BRANCH"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -361,6 +418,22 @@ cmd_diff() {
...
@@ -361,6 +418,22 @@ cmd_diff() {
fi
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() {
cmd_rebase() {
DEFINE_boolean interactive false 'do an interactive rebase' i
DEFINE_boolean interactive false 'do an interactive rebase' i
parse_args "$@"
parse_args "$@"
...
@@ -376,3 +449,51 @@ cmd_rebase() {
...
@@ -376,3 +449,51 @@ cmd_rebase() {
fi
fi
git rebase $OPTS "$DEVELOP_BRANCH"
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
}
git-flow-hotfix
View file @
298514b6
...
@@ -3,13 +3,37 @@
...
@@ -3,13 +3,37 @@
# repository operations for Vincent Driessen's branching model.
# repository operations for Vincent Driessen's branching model.
#
#
# Original blog post presenting this model is found at:
# 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:
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
# http://github.com/nvie/gitflow
#
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright 2010 Vincent Driessen. All rights reserved.
# Copyright (c) 2010 by Benedikt Böhm
#
# 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
require_git_repo
...
@@ -38,6 +62,11 @@ cmd_list() {
...
@@ -38,6 +62,11 @@ cmd_list() {
hotfix_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
hotfix_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
if [ -z "$hotfix_branches" ]; then
if [ -z "$hotfix_branches" ]; then
warn "No hotfix branches exist."
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
exit 0
fi
fi
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
...
@@ -124,7 +153,7 @@ require_no_existing_hotfix_branches() {
...
@@ -124,7 +153,7 @@ require_no_existing_hotfix_branches() {
}
}
cmd_start() {
cmd_start() {
DEFINE_boolean fetch
tru
e "fetch from $ORIGIN before performing finish" F
DEFINE_boolean fetch
fals
e "fetch from $ORIGIN before performing finish" F
parse_args "$@"
parse_args "$@"
BASE=${2:-$MASTER_BRANCH}
BASE=${2:-$MASTER_BRANCH}
require_version_arg
require_version_arg
...
@@ -138,7 +167,9 @@ cmd_start() {
...
@@ -138,7 +167,9 @@ cmd_start() {
if flag fetch; then
if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH"
git fetch -q "$ORIGIN" "$MASTER_BRANCH"
fi
fi
if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi
# create branch
# create branch
git checkout -b "$BRANCH" "$BASE"
git checkout -b "$BRANCH" "$BASE"
...
@@ -158,7 +189,7 @@ cmd_start() {
...
@@ -158,7 +189,7 @@ cmd_start() {
}
}
cmd_finish() {
cmd_finish() {
DEFINE_boolean fetch
tru
e "fetch from $ORIGIN before performing finish" F
DEFINE_boolean fetch
fals
e "fetch from $ORIGIN before performing finish" F
DEFINE_boolean sign false "sign the release tag cryptographically" s
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 signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
DEFINE_string message "" "use the given tag message" m
DEFINE_string message "" "use the given tag message" m
...
@@ -180,8 +211,12 @@ cmd_finish() {
...
@@ -180,8 +211,12 @@ cmd_finish() {
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
fi
if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
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"
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# try to merge into master
# try to merge into master
# in case a previous attempt to finish this release branch has failed,
# in case a previous attempt to finish this release branch has failed,
...
...
git-flow-init
View file @
298514b6
...
@@ -3,13 +3,37 @@
...
@@ -3,13 +3,37 @@
# repository operations for Vincent Driessen's branching model.
# repository operations for Vincent Driessen's branching model.
#
#
# Original blog post presenting this model is found at:
# 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:
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
# http://github.com/nvie/gitflow
#
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright 2010 Vincent Driessen. All rights reserved.
# Copyright (c) 2010 by Benedikt Böhm
#
# 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.
#
#
usage() {
usage() {
...
@@ -61,7 +85,7 @@ cmd_default() {
...
@@ -61,7 +85,7 @@ cmd_default() {
if [ "$branch_count" -eq 0 ]; then
if [ "$branch_count" -eq 0 ]; then
echo "No branches exist yet. Base branches must be created now."
echo "No branches exist yet. Base branches must be created now."
should_check_existence=NO
should_check_existence=NO
default_suggestion=
master
default_suggestion=
$(git config --get gitflow.branch.master || echo master)
else
else
echo
echo
echo "Which branch should be used for bringing forth production releases?"
echo "Which branch should be used for bringing forth production releases?"
...
@@ -69,7 +93,8 @@ cmd_default() {
...
@@ -69,7 +93,8 @@ cmd_default() {
should_check_existence=YES
should_check_existence=YES
default_suggestion=
default_suggestion=
for guess in 'production' 'main' 'master'; do
for guess in $(git config --get gitflow.branch.master) \
'production' 'main' 'master'; do
if git_local_branch_exists "$guess"; then
if git_local_branch_exists "$guess"; then
default_suggestion="$guess"
default_suggestion="$guess"
break
break
...
@@ -77,7 +102,7 @@ cmd_default() {
...
@@ -77,7 +102,7 @@ cmd_default() {
done
done
fi
fi
echo "Branch name for production releases: [$default_suggestion] \c
"
printf "Branch name for production releases: [$default_suggestion]
"
read answer
read answer
master_branch=${answer:-$default_suggestion}
master_branch=${answer:-$default_suggestion}
...
@@ -103,7 +128,7 @@ cmd_default() {
...
@@ -103,7 +128,7 @@ cmd_default() {
branch_count=$(git_local_branches | grep -v "^${master_branch}\$" | wc -l)
branch_count=$(git_local_branches | grep -v "^${master_branch}\$" | wc -l)
if [ "$branch_count" -eq 0 ]; then
if [ "$branch_count" -eq 0 ]; then
should_check_existence=NO
should_check_existence=NO
default_suggestion=
develop
default_suggestion=
$(git config --get gitflow.branch.develop || echo develop)
else
else
echo
echo
echo "Which branch should be used for integration of the \"next release\"?"
echo "Which branch should be used for integration of the \"next release\"?"
...
@@ -111,7 +136,8 @@ cmd_default() {
...
@@ -111,7 +136,8 @@ cmd_default() {
should_check_existence=YES
should_check_existence=YES
default_suggestion=
default_suggestion=
for guess in 'develop' 'int' 'integration' 'master'; do
for guess in $(git config --get gitflow.branch.develop) \
'develop' 'int' 'integration' 'master'; do
if git_local_branch_exists "$guess"; then
if git_local_branch_exists "$guess"; then
default_suggestion="$guess"
default_suggestion="$guess"
break
break
...
@@ -119,7 +145,7 @@ cmd_default() {
...
@@ -119,7 +145,7 @@ cmd_default() {
done
done
fi
fi
echo "Branch name for \"next release\" development: [$default_suggestion] \c
"
printf "Branch name for \"next release\" development: [$default_suggestion]
"
read answer
read answer
develop_branch=${answer:-$default_suggestion}
develop_branch=${answer:-$default_suggestion}
...
@@ -161,7 +187,7 @@ cmd_default() {
...
@@ -161,7 +187,7 @@ cmd_default() {
# default production branch and develop was "created". We should create
# default production branch and develop was "created". We should create
# the develop branch now in that case (we base it on master, of course)
# the develop branch now in that case (we base it on master, of course)
if ! git_local_branch_exists "$develop_branch"; then
if ! git_local_branch_exists "$develop_branch"; then
git branch "$develop_branch" "$master_branch"
git branch
--no-track
"$develop_branch" "$master_branch"
created_gitflow_branch=1
created_gitflow_branch=1
fi
fi
...
@@ -174,15 +200,22 @@ cmd_default() {
...
@@ -174,15 +200,22 @@ cmd_default() {
fi
fi
# finally, ask the user for naming conventions (branch and tag prefixes)
# finally, ask the user for naming conventions (branch and tag prefixes)
if flag force || \
! git config --get gitflow.prefix.feature >/dev/null 2>&1 ||
! git config --get gitflow.prefix.release >/dev/null 2>&1 ||
! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 ||
! git config --get gitflow.prefix.support >/dev/null 2>&1 ||
! git config --get gitflow.prefix.versiontag >/dev/null 2>&1; then
echo
echo
echo "How to name your supporting branch prefixes?"
echo "How to name your supporting branch prefixes?"
fi
local prefix
local prefix
# Feature branches
# Feature branches
if ! git config --get gitflow.prefix.feature >/dev/null 2>&1 || flag force; then
if ! git config --get gitflow.prefix.feature >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.feature || echo feature/)
default_suggestion=$(git config --get gitflow.prefix.feature || echo feature/)
echo "Feature branches? [$default_suggestion] \c
"
printf "Feature branches? [$default_suggestion]
"
read answer
read answer
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.feature "$prefix"
git config gitflow.prefix.feature "$prefix"
...
@@ -191,7 +224,7 @@ cmd_default() {
...
@@ -191,7 +224,7 @@ cmd_default() {
# Release branches
# Release branches
if ! git config --get gitflow.prefix.release >/dev/null 2>&1 || flag force; then
if ! git config --get gitflow.prefix.release >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.release || echo release/)
default_suggestion=$(git config --get gitflow.prefix.release || echo release/)
echo "Release branches? [$default_suggestion] \c
"
printf "Release branches? [$default_suggestion]
"
read answer
read answer
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.release "$prefix"
git config gitflow.prefix.release "$prefix"
...
@@ -201,7 +234,7 @@ cmd_default() {
...
@@ -201,7 +234,7 @@ cmd_default() {
# Hotfix branches
# Hotfix branches
if ! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 || flag force; then
if ! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
default_suggestion=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
echo "Hotfix branches? [$default_suggestion] \c
"
printf "Hotfix branches? [$default_suggestion]
"
read answer
read answer
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.hotfix "$prefix"
git config gitflow.prefix.hotfix "$prefix"
...
@@ -211,7 +244,7 @@ cmd_default() {
...
@@ -211,7 +244,7 @@ cmd_default() {
# Support branches
# Support branches
if ! git config --get gitflow.prefix.support >/dev/null 2>&1 || flag force; then
if ! git config --get gitflow.prefix.support >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.support || echo support/)
default_suggestion=$(git config --get gitflow.prefix.support || echo support/)
echo "Support branches? [$default_suggestion] \c
"
printf "Support branches? [$default_suggestion]
"
read answer
read answer
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.support "$prefix"
git config gitflow.prefix.support "$prefix"
...
@@ -221,7 +254,7 @@ cmd_default() {
...
@@ -221,7 +254,7 @@ cmd_default() {
# Version tag prefix
# Version tag prefix
if ! git config --get gitflow.prefix.versiontag >/dev/null 2>&1 || flag force; then
if ! git config --get gitflow.prefix.versiontag >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.versiontag || echo "")
default_suggestion=$(git config --get gitflow.prefix.versiontag || echo "")
echo "Version tag prefix? [$default_suggestion] \c
"
printf "Version tag prefix? [$default_suggestion]
"
read answer
read answer
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.versiontag "$prefix"
git config gitflow.prefix.versiontag "$prefix"
...
...
git-flow-release
View file @
298514b6
...
@@ -3,13 +3,37 @@
...
@@ -3,13 +3,37 @@
# repository operations for Vincent Driessen's branching model.
# repository operations for Vincent Driessen's branching model.
#
#
# Original blog post presenting this model is found at:
# 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:
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
# http://github.com/nvie/gitflow
#
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright 2010 Vincent Driessen. All rights reserved.
# Copyright (c) 2010 by Benedikt Böhm
#
# 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
require_git_repo
...
@@ -38,6 +62,11 @@ cmd_list() {
...
@@ -38,6 +62,11 @@ cmd_list() {
release_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
release_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
if [ -z "$release_branches" ]; then
if [ -z "$release_branches" ]; then
warn "No release branches exist."
warn "No release branches exist."
warn ""
warn "You can start a new release branch:"
warn ""
warn " git flow release start <name> [<base>]"
warn ""
exit 0
exit 0
fi
fi
...
@@ -119,7 +148,7 @@ require_no_existing_release_branches() {
...
@@ -119,7 +148,7 @@ require_no_existing_release_branches() {
}
}
cmd_start() {
cmd_start() {
DEFINE_boolean fetch
tru
e "fetch from $ORIGIN before performing finish" F
DEFINE_boolean fetch
fals
e "fetch from $ORIGIN before performing finish" F
parse_args "$@"
parse_args "$@"
BASE=${2:-$DEVELOP_BRANCH}
BASE=${2:-$DEVELOP_BRANCH}
require_version_arg
require_version_arg
...
@@ -133,7 +162,9 @@ cmd_start() {
...
@@ -133,7 +162,9 @@ cmd_start() {
if flag fetch; then
if flag fetch; then
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
fi
if has "$ORIGIN/$DEVELOP_BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# create branch
# create branch
git checkout -b "$BRANCH" "$BASE"
git checkout -b "$BRANCH" "$BASE"
...
@@ -153,7 +184,7 @@ cmd_start() {
...
@@ -153,7 +184,7 @@ cmd_start() {
}
}
cmd_finish() {
cmd_finish() {
DEFINE_boolean fetch
tru
e "fetch from $ORIGIN before performing finish" F
DEFINE_boolean fetch
fals
e "fetch from $ORIGIN before performing finish" F
DEFINE_boolean sign false "sign the release tag cryptographically" s
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 signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
DEFINE_string message "" "use the given tag message" m
DEFINE_string message "" "use the given tag message" m
...
@@ -176,8 +207,12 @@ cmd_finish() {
...
@@ -176,8 +207,12 @@ cmd_finish() {
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
fi
if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
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"
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# try to merge into master
# try to merge into master
# in case a previous attempt to finish this release branch has failed,
# in case a previous attempt to finish this release branch has failed,
...
...
git-flow-support
View file @
298514b6
...
@@ -3,13 +3,37 @@
...
@@ -3,13 +3,37 @@
# repository operations for Vincent Driessen's branching model.
# repository operations for Vincent Driessen's branching model.
#
#
# Original blog post presenting this model is found at:
# 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:
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
# http://github.com/nvie/gitflow
#
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright 2010 Vincent Driessen. All rights reserved.
# Copyright (c) 2010 by Benedikt Böhm
#
# 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
require_git_repo
...
@@ -40,6 +64,11 @@ cmd_list() {
...
@@ -40,6 +64,11 @@ cmd_list() {
support_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
support_branches=$(echo "$(git_local_branches)" | grep "^$PREFIX")
if [ -z "$support_branches" ]; then
if [ -z "$support_branches" ]; then
warn "No support branches exist."
warn "No support branches exist."
warn ""
warn "You can start a new support branch:"
warn ""
warn " git flow support start <name> <base>"
warn ""
exit 0
exit 0
fi
fi
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
...
@@ -127,7 +156,7 @@ require_base_is_on_master() {
...
@@ -127,7 +156,7 @@ require_base_is_on_master() {
}
}
cmd_start() {
cmd_start() {
DEFINE_boolean fetch
tru
e "fetch from $ORIGIN before performing finish" F
DEFINE_boolean fetch
fals
e "fetch from $ORIGIN before performing finish" F
parse_args "$@"
parse_args "$@"
require_version_arg
require_version_arg
require_base_arg
require_base_arg
...
...
git-flow-version
View file @
298514b6
...
@@ -3,15 +3,40 @@
...
@@ -3,15 +3,40 @@
# repository operations for Vincent Driessen's branching model.
# repository operations for Vincent Driessen's branching model.
#
#
# Original blog post presenting this model is found at:
# 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:
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
# http://github.com/nvie/gitflow
#
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright 2010 Vincent Driessen. All rights reserved.
# Copyright (c) 2010 by Benedikt Böhm
#
#
GITFLOW_VERSION=0.2.1
# 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.
#
GITFLOW_VERSION=0.3
usage() {
usage() {
echo "usage: git flow version"
echo "usage: git flow version"
...
...
gitflow-common
View file @
298514b6
...
@@ -3,13 +3,37 @@
...
@@ -3,13 +3,37 @@
# repository operations for Vincent Driessen's branching model.
# repository operations for Vincent Driessen's branching model.
#
#
# Original blog post presenting this model is found at:
# 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:
# Feel free to contribute to this project at:
# http://github.com/nvie/gitflow
# http://github.com/nvie/gitflow
#
#
# Copyright (c) 2010 by Vincent Driessen
# Copyright 2010 Vincent Driessen. All rights reserved.
# Copyright (c) 2010 by Benedikt Böhm
#
# 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.
#
#
#
#
...
@@ -182,7 +206,7 @@ gitflow_resolve_nameprefix() {
...
@@ -182,7 +206,7 @@ gitflow_resolve_nameprefix() {
local num_matches
local num_matches
# first, check if there is a perfect match
# first, check if there is a perfect match
if
has "$(git_local_branches)"
"$prefix$name"; then
if
git_local_branch_exists
"$prefix$name"; then
echo "$name"
echo "$name"
return 0
return 0
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment