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.
Git Flow can be installed alongside TortoiseGit without issue, but there are some steps needed.
- Download/Install msysGit
- Download this file: bin.zip
- Extract
bin.zip
to:%%PROGRAMFILES%%\Git
(it should place files into the.\Git\bin
directory) - Download this file: git-core.zip
- Extract
git-core.zip
to:%%PROGRAMFILES%%\Git\libexec
(it should place files into.\Git\libexec\git-core
directory)
Done!
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
.