in git

Using git flow in Mac OSX (CLI based approach)

Installation :

  • Homebrew

If you’re using homebrew, it’s simple. :

$ brew install git-flow
  • MacPorts

If you’re using MacPorts, it’s simple, too:

$ port install git-flow

If you run into problems due to Xcode 4.2 upgrades & MacPorts 2.04 with the expat dependency not installing then simply use the workaround specified in https://trac.macports.org/wiki/ProblemHotlist like so:

$ sudo port install expat
--->  Configuring expat
Error: Target org.macports.configure returned: configure failure: shell command failed (see log for details)
Log for expat is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_expat/expat/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>

$ sudo port clean expat
--->  Cleaning expat
$ sudo port install expat configure.compiler=llvm-gcc-4.2
--->  Fetching archive for expat
--->  Attempting to fetch expat-2.1.0_0.darwin_11.x86_64.tbz2 from http://packages.macports.org/expat
--->  Attempting to fetch expat-2.1.0_0.darwin_11.x86_64.tbz2.rmd160 from http://packages.macports.org/expat
--->  Installing expat @2.1.0_0
--->  Activating expat @2.1.0_0
--->  Cleaning expat 

$ port install git-flow
  • wget

Even using wget its a one line effort.

wget --no-check-certificate -q -O - https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo bash
  • curl

wget: command not found? curl is only option.

curl -L -O https://raw.github.com/nvie/gitflow/develop/contrib/gitflow-installer.sh
sudo bash gitflow-installer.sh

Commands to use git-flow :

Initializing git-flow

git flow init -d

Above command will setup branches for your project.

Which branch should be used for bringing forth production releases?
   - master
Branch name for production releases: [master] 
Branch name for "next release" development: [develop] 

How to name your supporting branch prefixes?
Feature branches? [feature/] 
Release branches? [release/] 
Hotfix branches? [hotfix/] 
Support branches? [support/] 
Version tag prefix? [] ee-v

We are using default configuration for this project.

How to start for new feature.

git flow feature start <feature-name>

here will be the branch like feature/

Publish newly created feature.

You must publish your feature as you are working on collaboration over that feature.

git flow feature publish <feature-name>

Pull the newly published feature (For dev other than who published)

git flow feature pull <feature-name>

Finish the feature

git flow feature finish <feature-name>

Finishing a feature will merge your feature branch to develop branch.

How to start for release

git flow release start <releasename>

for example:

git flow release start v3.x.x

This will create a branch release/v3.x.x from develop branch.

Publish the release

git flow release publish <releasename>

For example:

git flow release publish v3.x.x

Finish the release

git flow release finish <releasename>

For example:

git flow release finish v3.x.x

Push tags

git push --tags

How to start hotfix

Hot fixes are forked from master branches.

git flow hotfix start <hotfix version>

For example:

git flow hotfix start <v3.1.x>

Finishing Hotfix

git flow hotfix finish <hotfix version>

For example:

git flow hotfix finish v3.1.x

Finishing a hotfix will merge the hotfix in master and develop branch.