Skip to content

Instantly share code, notes, and snippets.

@leek
Created September 21, 2011 20:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leek/1233135 to your computer and use it in GitHub Desktop.
Save leek/1233135 to your computer and use it in GitHub Desktop.
git flow Introduction

About Git Flow

Git Flow is an extension to Git that provides extra functionality and simple commands that force you into a structured and proper branching model. Git Flow is not required and in fact all commands ran by Git Flow can be done using standard Git commands. Git Flow just makes everything easier. Git Flow only needs to be installed on the developer's machine (or wherever development happens) and not on any production server.

Installing on Windows

Git Flow can be installed alongside TortoiseGit without issue, but there are some steps needed.

  1. Download/Install msysGit
  2. Download this file: bin.zip
  3. Extract bin.zip to: %%PROGRAMFILES%%\Git (it should place files into the .\Git\bin directory)
  4. Download this file: git-core.zip
  5. Extract git-core.zip to: %%PROGRAMFILES%%\Git\libexec (it should place files into .\Git\libexec\git-core directory)

Done!

Using Git Flow

This is only a quick reference, most of which can be obtained elsewhere. The first step is to open a command prompt to the directory where your Git clone is so we can initialize Git Flow. Do this by entering the following command:

git flow init

This will run you through some questions, just leave the defaults for now and press enter for all. This will create the following branching model:

Branch List

  • master (holds an exact replica of current production code)
  • develop (stable development branch which holds completed but unpushed code)

Now, let's say you'd like to start work on a new feature. All you need to do is the following:

git flow feature start <FEATURE-NAME>

This command creates a new branch (feature/<FEATURE-NAME>) based off of our develop branch and switches to it. Now we would work away on our new feature (issuing commits every so often with helpful commit messages) and when we are finished - all we have to do is finish our feature in Git Flow:

git flow feature finish <FEATURE-NAME>

This will merge our feature branch back into develop and delete the feature branch. It will then switch your working copy back to develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment