Merge branch 'debian-installer' into develop
Conflicts:
README.mdown
diff --git a/AUTHORS b/AUTHORS
index d4e7490..f7d1e66 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -16,5 +16,8 @@
- Kiall Mac Innes
- Jon Bernard
- Olivier Mengué
+- Emre Berge Ergenekon
+- Eric Holmes
+- Vedang Manerikar
Portions derived from other open source works are clearly marked.
diff --git a/Changes.mdown b/Changes.mdown
index f38f90b..2281f23 100644
--- a/Changes.mdown
+++ b/Changes.mdown
@@ -2,12 +2,22 @@
-----
Release date: **not yet**
+* `git flow init` now detects situations where origin already has gitflow
+ branches set up, and behaves accordingly (thanks Emre Berge Ergenekon).
+
* `git flow feature finish` can now be called without a feature branch
name(prefix) argument and will finish the current branch, if on any.
-* Various minor bug fixes related to internal argument passing
+* `git flow feature pull` now has a `-r` flag, to support `pull --rebase`
+ semantics (thanks Vedang Manerikar).
-* Add package installers for the Windows platform.
+* Various minor bug fixes related to internal argument passing.
+
+* Improved some documentation.
+
+* Better support for Windows and BSD users.
+
+* Add package installer for the Windows platform.
0.4.1:
-----
diff --git a/README.mdown b/README.mdown
index aa9a6a2..c7238e6 100644
--- a/README.mdown
+++ b/README.mdown
@@ -1,5 +1,6 @@
-git-flow 
+git-flow
========
+
A collection of Git extensions to provide high-level repository operations
for Vincent Driessen's [branching model](http://nvie.com/git-model "original
blog post").
@@ -14,87 +15,14 @@
Or have a look at one of these screen casts:
+* [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)
* [A short introduction to git-flow](http://vimeo.com/16018419) (by Mark Derricutt)
* [On the path with git-flow](http://codesherpas.com/screencasts/on_the_path_gitflow.mov) (by Dave Bock)
Installing git-flow
-------------------
-
-### Mac OS
-If you're on a Mac and use [homebrew](http://github.com/mxcl/homebrew), it's simple:
-
- $ brew install git-flow
-
-If you're on a Mac and use [MacPorts](http://macports.org/), it's simple:
-
- $ port install git-flow
-
-### Linux, etc.
-Another easy way to install git-flow is using Rick Osborne's excellent git-flow
-installer, which can be run using the following command:
-
- $ wget --no-check-certificate -q -O - https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo bash
-
-#### Debian
-
-Users of Debian testing and unstable can use the apt-get tool to
-install gitflow from the Debian repository:
-
- $ apt-get install git-flow
-
-For Debian stable, one can either use the git flow installer, or the
-Debian package from unstable (it works just fine on stable too).
-
-### Windows
-
-For Windows users, [msysgit](http://code.google.com/p/msysgit/) is a good
-starting place for installing git.
-
-#### Using Cygwin
-For Windows users who wish to use the automated install, it is suggested that you install [Cygwin](http://www.cygwin.com/)
-first to install tools like `git`, `util-linux` and `wget` (with those three being packages that can be selected
-during installation). Then simply run this command from a Cygwin shell:
-
- $ wget -q -O - https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | bash
-
-#### Using [msysgit](http://code.google.com/p/msysgit/)
-Download and install `getopt.exe` from the [util-linux package](http://gnuwin32.sourceforge.net/packages/util-linux-ng.htm) into `C:\Program Files\Git\bin`. (Only `getopt.exe`, the others util-linux files are not used). Also install `libintl3.dll` from the Dependencies package, into the same directory.
-
-Clone the git-flow sources from GitHub:
-
- $ git clone --recursive git://github.com/nvie/gitflow.git
- $ cd gitflow
-
-Run the `msysgit-install` script from a command-line prompt (you may have to
-run it with "Full Administrator" rights if you installed msysgit with its
-installer):
-
- C:\gitflow> contrib\msysgit-install.cmd
-
-### Manual installation
-If you prefer a manual installation, please use the following instructions:
-
- $ git clone --recursive git://github.com/nvie/gitflow.git
-
-Then, you can install `git-flow`, using:
-
- $ sudo make install
-
-By default, git-flow will be installed in /usr/local. To change the prefix
-where git-flow will be installed, simply specify it explicitly, using:
-
- $ sudo make prefix=/opt/local install
-
-Or simply point your `PATH` environment variable to your git-flow checkout
-directory.
-
-*Installation note:*
-git-flow depends on the availability of the command line utility `getopt`,
-which may not be available in your Unix/Linux environment. Please use your
-favorite package manager to install `getopt`. For Cygwin, install the
-`util-linux` package to get `getopt`. If you use `apt-get` as your install
-manager, the package name is `opt`.
+See the Wiki for up-to-date [Installation Instructions](https://github.com/nvie/gitflow/wiki/Installation).
Integration with your shell
@@ -125,6 +53,23 @@
Any questions, tips, or general discussion can be posted to our Google group:
[http://groups.google.com/group/gitflow-users](http://groups.google.com/group/gitflow-users)
+Contributing
+------------
+Fork the repository. Then, run:
+
+ git clone --recursive git@github.com:<username>/gitflow.git
+ cd gitflow
+ git branch master origin/master
+ git flow init -d
+ git flow feature start <your feature>
+
+Then, do work and commit your changes. **Hint**: ``export PATH=`pwd`:$PATH``
+from within the gitflow directory makes sure you're using the version of
+gitflow you're currently developing.
+
+ git flow feature publish <your feature>
+
+When done, open a pull request to your feature branch.
License terms
-------------
@@ -139,13 +84,15 @@
To initialize a new repo with the basic branch structure, use:
- git flow init
+ git flow init [-d]
This will then interactively prompt you with some questions on which branches
you would like to use as development and production branches, and how you
would like your prefixes be named. You may simply press Return on any of
those questions to accept the (sane) default suggestions.
+The ``-d`` flag will accept all defaults.
+
### Creating feature/release/hotfix/support branches
@@ -157,6 +104,11 @@
For feature branches, the `<base>` arg must be a commit on `develop`.
+* To push/pull a feature branch to the remote repository, use:
+
+ git flow feature publish <name>
+ git flow feature pull <remote> <name>
+
* To list/start/finish release branches, use:
git flow release
diff --git a/contrib/msysgit-install.cmd b/contrib/msysgit-install.cmd
index 1285839..5f005bf 100644
--- a/contrib/msysgit-install.cmd
+++ b/contrib/msysgit-install.cmd
@@ -22,11 +22,11 @@
if not exist "%GIT_HOME%\bin\git-flow" goto :Install
echo GitFlow is already installed.>&2
-choice /C YN /M "Do you want to replace it"
-if errorlevel 255 goto :Abort
-if errorlevel 2 goto :Abort
-if not errorlevel 1 goto :Abort
+set /p mychoice="Do you want to replace it [y/n]"
+if "%mychoice%"=="y" goto :DeleteOldFiles
+goto :Abort
+:DeleteOldFiles
echo Deleting old files...
for /F %%i in ("%GIT_HOME%\git-flow*" "%GIT_HOME%\gitflow-*") do if exist "%%~fi" del /F /Q "%%~fi"
diff --git a/git-flow b/git-flow
index 97b1b34..93e9f0f 100755
--- a/git-flow
+++ b/git-flow
@@ -37,12 +37,17 @@
# policies, either expressed or implied, of Vincent Driessen.
#
+# set this to workaround expr problems in shFlags on freebsd
+if uname -s | egrep -iq 'bsd'; then export EXPR_COMPAT=1; fi
+
# enable debug mode
if [ "$DEBUG" = "yes" ]; then
set -x
fi
-export GITFLOW_DIR=$(dirname "$0")
+# The sed expression here replaces all backslashes by forward slashes.
+# This helps our Windows users, while not bothering our Unix users.
+export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
usage() {
echo "usage: git flow <subcommand>"
diff --git a/git-flow-feature b/git-flow-feature
index 9da4b0b..e97d678 100644
--- a/git-flow-feature
+++ b/git-flow-feature
@@ -44,13 +44,13 @@
usage() {
echo "usage: git flow feature [list] [-v]"
echo " git flow feature start [-F] <name> [<base>]"
- echo " git flow feature finish [-rFk] [<name|nameprefix>]"
+ echo " git flow feature finish [-rFkD] [<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>]"
+ echo " git flow feature pull [-r] <remote> [<name>]"
}
cmd_default() {
@@ -231,6 +231,7 @@
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
DEFINE_boolean rebase false "rebase instead of merge" r
DEFINE_boolean keep false "keep branch after performing finish" k
+ DEFINE_boolean force_delete false "force delete feature branch after finish" D
parse_args "$@"
expand_nameprefix_arg_or_current
@@ -346,7 +347,11 @@
if noflag keep; then
- git branch -d "$BRANCH"
+ if flag force_delete; then
+ git branch -D "$BRANCH"
+ else
+ git branch -d "$BRANCH"
+ fi
fi
echo
@@ -470,6 +475,7 @@
cmd_pull() {
#DEFINE_string prefix false 'alternative remote feature branch name prefix' p
+ DEFINE_boolean rebase false "pull with rebase" r
parse_remote_name "$@"
if [ -z "$REMOTE" ]; then
@@ -495,7 +501,15 @@
# 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'."
+ if flag rebase; then
+ if ! git pull --rebase -q "$REMOTE" "$BRANCH"; then
+ warn "Pull was aborted. There might be conflicts during rebase or '$REMOTE' might be inaccessible."
+ exit 1
+ fi
+ else
+ it pull -q "$REMOTE" "$BRANCH" || die "Failed to pull from remote '$REMOTE'."
+ fi
+
echo "Pulled $REMOTE's changes into $BRANCH."
else
# setup the local branch clone for the first time
diff --git a/git-flow-hotfix b/git-flow-hotfix
index 2618113..b355f30 100644
--- a/git-flow-hotfix
+++ b/git-flow-hotfix
@@ -46,6 +46,7 @@
echo "usage: git flow hotfix [list] [-v]"
echo " git flow hotfix start [-F] <version> [<base>]"
echo " git flow hotfix finish [-Fsumpk] <version>"
+ echo " git flow hotfix publish <version>"
}
cmd_default() {
@@ -188,6 +189,33 @@
echo
}
+cmd_publish() {
+ parse_args "$@"
+ require_version_arg
+
+ # sanity checks
+ require_clean_working_tree
+ require_branch "$BRANCH"
+ git fetch -q "$ORIGIN"
+ require_branch_absent "$ORIGIN/$BRANCH"
+
+ # create remote branch
+ git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
+ git fetch -q "$ORIGIN"
+
+ # configure remote tracking
+ git config "branch.$BRANCH.remote" "$ORIGIN"
+ git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
+ git checkout "$BRANCH"
+
+ echo
+ echo "Summary of actions:"
+ echo "- A new remote branch '$BRANCH' was created"
+ echo "- The local branch '$BRANCH' was configured to track the remote branch"
+ echo "- You are now on branch '$BRANCH'"
+ echo
+}
+
cmd_finish() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
DEFINE_boolean sign false "sign the release tag cryptographically" s
@@ -241,7 +269,7 @@
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
- git tag $opts "$VERSION_PREFIX$VERSION" || \
+ eval git tag $opts "$VERSION_PREFIX$VERSION" || \
die "Tagging failed. Please run finish again to retry."
fi
fi
diff --git a/git-flow-init b/git-flow-init
index 57ab244..4afa1c2 100644
--- a/git-flow-init
+++ b/git-flow-init
@@ -117,8 +117,14 @@
# check existence in case of an already existing repo
if [ "$should_check_existence" = "YES" ]; then
- git_local_branch_exists "$master_branch" || \
+ # if no local branch exists and a remote branch of the same
+ # name exists, checkout that branch and use it for master
+ if ! git_local_branch_exists "$master_branch" && \
+ git_remote_branch_exists "origin/$master_branch"; then
+ git branch "$master_branch" "origin/$master_branch" >/dev/null 2>&1
+ elif ! git_local_branch_exists "$master_branch"; then
die "Local branch '$master_branch' does not exist."
+ fi
fi
# store the name of the master branch
@@ -200,7 +206,11 @@
# default production branch and develop was "created". We should create
# the develop branch now in that case (we base it on master, of course)
if ! git_local_branch_exists "$develop_branch"; then
- git branch --no-track "$develop_branch" "$master_branch"
+ if git_remote_branch_exists "origin/$develop_branch"; then
+ git branch "$develop_branch" "origin/$develop_branch" >/dev/null 2>&1
+ else
+ git branch --no-track "$develop_branch" "$master_branch"
+ fi
created_gitflow_branch=1
fi
diff --git a/git-flow-release b/git-flow-release
index 08f595b..bb39d52 100644
--- a/git-flow-release
+++ b/git-flow-release
@@ -239,7 +239,7 @@
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
- git tag $opts "$tagname" || \
+ eval git tag $opts "$tagname" || \
die "Tagging failed. Please run finish again to retry."
fi
fi
diff --git a/gitflow-common b/gitflow-common
index 252f5d0..4834cf1 100644
--- a/gitflow-common
+++ b/gitflow-common
@@ -45,7 +45,7 @@
die() { warn "$@"; exit 1; }
escape() {
- echo "$1" | sed 's/\([\.\+\$\*]\)/\\\1/g'
+ echo "$1" | sed 's/\([\.\$\*]\)/\\\1/g'
}
# set logic
@@ -97,6 +97,10 @@
has $1 $(git_local_branches)
}
+git_remote_branch_exists() {
+ has $1 $(git_remote_branches)
+}
+
git_branch_exists() {
has $1 $(git_all_branches)
}