Sunday, December 21, 2014

Creating a Git-Flow branching structure using Source Tree

Git Flow is an add-on package to Git, which provides a set of commands to create and manage the branches. SourceTree supports Git Flow, it provides as icon in the tool bar to create and manage Git Flow.

Let us create a branch structure proposed by Git-flow for one of the repository, I have a repository called GitDocuments, and there is only one branch origin/master, now let us use Source Tree and create a Git-flow based branching model for this repository.

Git-flow working branches

Git Flow is an add-on package to Git, which provides a set of commands to create and manage the branches. By default Got flow creates the following 2 branches

What is Git Flow

Git flow is a branching model proposed by Vincent Driessen, this model aims in standardizing the branching and merging operations for a project. If there is not fixed model then, every project will have its own set of branched which will not be easy for others to understand, hence it is advisable to go for a standard set of branches to make the version control clean and reusable.

Git flow, abstracts the development team from the underlying Git commands, they can work on the repository using the Git-flow commands instead of directly using the underlying Git commands.

Git flow defines the following the following branches for a repository.

Pull in SourceTree

The pull command in Git/Source Tree is used to get the changes (commits) from remote repository to the local repositories, the changes are fetched and merged with the local working folder.

Pull can be done on a specific branch or on all the branches, by selecting the appropriate option. Use the following steps to pull the latest details (commits) from a remote branch to the local working folder using Source tree.

Fetch in SourceTree

The fetch command in Git/Source Tree is used to get the changes (commits) from remote repository to the local repositories, the local working copy is not affected as a result of executing the Fetch command, this gives an opportunity to get the remote changes and do a comparison with the local version before we merge and commit the local changes.

Fetch can be done on a specific branch or on all the branches, by selecting the appropriate option. Use the following steps to fetch the latest details (commits) from a remote branch to the local branch using Source tree.