GitFlow: A Better Branching Strategy for Your Projects - #2 Installing and Setting Up GitFlow On Windows

GitFlow: A Better Branching Strategy for Your Projects - #2 Installing and Setting Up GitFlow On Windows

In the last post which was the Introduction to GitFlow Branching Model, we discussed about what GitFlow is and what benefits it brings to a development team. Let’s look at how to Install GitFlow extensions on windows to allow us to use the GitFlow branching strategy for our projects. Let’s start with installing GitFlow.

If you remember the special note in the Introductory post about the use of the word GitFlow. If not here it is again ;)

In this series of posts, we will talk about a collection of extensions to Git that allows us to easily use the GitFlow branching strategy as well. This set of extension is also called GitFlow. So, I will use GitFlow when mentioning the Branching Model as well as the set of extensions and how to use it.

So, in this post we will talk about GitFlow: The collection of extensions for Git. These extensions provide a high-level repository operation feature that are really useful. These repository operations are based upon the branching strategy by Vincent Driessen.

Note: Before you start, you need to have Git for Windows installed in your Windows System. If not download Git For Windows from the download link here.

Installing GitFlow on Windows

Make sure you have Git for Windows installed in your PC before you continue. You can find the download link here.

To run the commands successfully you need to open up a command line in Administrator Mode. So open up a command line in Administrator Permissions and navigate to a desired folder to begin installation of GitFlow in to your Windows installation.

First you need to clone the GitFlow repository from GitHub. Use the following command for the clone.

git clone –-recursive git://github.com/nvie/gitflow.git

This will create a folder called gitflow on your directory where you are in currently. You need to switch to that gitflow directory next. Use the following command to switch to gitflow folder.

cd gitflow

Then you need to run the following command with the correct path to the Git installation on your PC. Install script by default will use C:\Program Files\Git path. But if you have a 32-bit installation, you need to provide the correct part which is “C:\Program Files (x86)” as a command line argument for the script.

Run the following command;

contrib\msysgit-install.cmd "C:\Program Files (x86)\Git\"

This will install GitFlow in to your Machine.

Installing the Necessary DLLs

Apart from installing GitFlow itself, to get it working we need some DDLs to be installed as well. These are already installed on Linux systems. But we need to install them in manually on Windows Systems.

You need 3 items installed in to the directory where your Git installed on the PC. 1 executable file and 2 DLLs.

  1. util-linux package – Includes the exe executable file
  2. libintl package – Includes the dll DLL file
  3. libiconv package – Includes the dll DLL file

All of these are zip files that include the necessary executable and the DLLs. (The download links are include in the list)

Instructions to find the files are below,

  • getopt.exe – Unzip the util-linux-ng package and navigate in to util-linux-ng-x.xx.x-bin > bin folder to find the getopt.exe file
  • libintl3.dll – Unzip the libintl-x.xx.x.bin.zip file and navigate in to libintl-x.xx.x.bin > bin folder to find the libintl3.dll file
  • libiconv2.dll – Unzip the libiconv-x.x.x-x-bin.zip file and navigate in to libiconv-x.x.x-x-bin > bin folder to find the libiconv2.dll file

Copy all 3 files and paste them in to where you have your Git installed. Normally C:\Program Files\Git\bin or C:\Program Files (x86)\Git\bin

Once this is done, Congratulations now the GitFlow is installed on your Windows System.

Initializing a Repository

After setting up GitFlow on your Windows System, you can use GitFLow in your Git repositories. Let’s try this out. Create a directory to be used as a git repository for this example. I will call the folder GitFlowDemo.

Using a command line navigate in to the folder you just created. To use the GitFlow, we need to things to be completed.

  1. Initialize the git repository
  2. Initialize GitFlow

To initialize the folder as a git repository, just enter the following command on the command line.

git init

1-git-init

This will initialize the folder as a git repository. Then we need to initialize the GitFlow. To see all the commands available in GitFlow in the command line just type git flow and enter. You will see all the commands available in GitFlow.

2-available-commands-in-git-flow

Now let’s initialize the GitFlow. Enter the following command on the command line.

git flow init

You will see that GitFlow needs to create some of the branches that are part of GitFlow. It will as for the production release branch which is master by default. And the next release branch for development, which is develop by default. It will ask for the supporting branch prefixes. For Feature, Bug fixes, Releases, Hot Fixes, Support etc. You can add any name you wish for this branches and prefixes.

But lets take the defaults for now. Accept all the defaults by pressing enter and GitFlow will be initialized for your git repository. See the screenshot below,

3-initializing-git-flow

Now You can see 2 branches are created. Master and develop. If you enter git branch in the command line, you will see the new branches and develop will be the active branch.

4-branches-created-by-gitflow

You can now add a remote repository for this git repo and push master and develop branches and any other branches you create to the remote repo.

Now we have Installed GitFlow on our Windows System, and Initialized a git repo with GitFlow. In the next post we will know more about how to use GitFlow with your project work.

 

GitFlow: A Better Branching Strategy for Your Projects - All Articles

You Might Also Like
Comments