Braching Mechanism: GIT VS TFS Workflows in GIT

check out the post right here Centralized Workflow

Work on only one branch called master and have your local master repository to commit in isolated environment and then merge to central server.Good for small teams working with not much requirement of code sharing.  Hard to maintain code stability on the master branch.

Create a bare repository in stash. Clone the repository from stash or git on your local machine. Start working on it. Follow the edit, stag and commit as many times as we want to our local repository then once we are ready to be pushed to central repository, do a push to remote origin branch repository.

If someone else has already done a commit to remote branch, you would like to do rebase to ensure history is maintained in linear fashion.

Git pull –rebase origin master will bring all changes that were done to the server since the last your last pull from the server and your change will be added to the tip of change done to the server..

Once you are done with merge or –rebase to your local repository, push your changes to the server [Rebasing is process where it bring two branches together in terms of commit]

We can also use merge command, however with merge command we have a disadvantage where addition merge commit is done. This is problem with merge in GIT, it basically creates an additional merge commit to wherever branch you do a merge.

For instance you are on dev. branch and tries to do a merge master there, it will create a merge commit on the dev. branch history.

To remove that commit or any commit, just do below reset.

GIT reset HEAD~1 –hard [There are different types of reset, more on that later]

Feature Branch Workflow

This is based on the concept of feature based branching mechanism.  You create an isolated branch on the server based on the feature and work as a team or individual on that feature on that branch without make the master branch unstable.

Once your piece of work is done and ready to merge. Do a push to the feature branch in GIT and merge it to master. The other way is to send the pull request to another developer for code review and then post code review, the reviewer will do the push to the branch.

Gitflow workflow

Develop, Feature , master , release and hotfix.

Continue to develop from feature branch and merge frequently to development. Then once it is relatively stable and ready to be shipped branch out to a release branch and do fixed while development is still ongoing on the feature and development branch.  Merge to master and release from there…

Create a hot fix branch if needed.

  • Development + Feature: Here Feature branch is for parallel development and Development is for integration of those features.
  • Release:Here release branch is for hotfixing the code just before the release.
  • Master:Here master branch is for releasing the code to production.
  • Hotfix:Here hotfix branch is for doing the hotfixes from production.

Forking workflow

The Forking Workflow is fundamentally different than the other workflows discussed here. Instead of using a single server-side repository to act as the “central” codebase, it gives every developer a server-side repository. This means that each contributor has not one, but two Git repositories: a private local one and a public server-side one.

The main advantage of the Forking Workflow is that contributions can be integrated without the need for everybody to push to a single central repository. Developers push to their own server-side repositories, and only the project maintainer can push to the official repository. This allows the maintainer to accept commits from any developer without giving them write access to the official codebase.

The result is a distributed workflow that provides a flexible way for large, organic teams (including untrusted third-parties) to collaborate securely. This also makes it an ideal workflow for open source projects.

How It Works

As in the other Git workflows, the Forking Workflow begins with an official public repository stored on a server. But when a new developer wants to start working on the project, they do not directly clone the official repository.

Instead, they fork the official repository to create a copy of it on the server. This new copy serves as their personal public repository—no other developers are allowed to push to it, but they can pull changes from it (we’ll see why this is important in a moment). After they have created their server-side copy, the developer performs a git clone to get a copy of it onto their local machine. This serves as their private development environment, just like in the other workflows.

When they’re ready to publish a local commit, they push the commit to their own public repository—not the official one. Then, they file a pull request with the main repository, which lets the project maintainer know that an update is ready to be integrated. The pull request also serves as a convenient discussion thread if there are issues with the contributed code.

To integrate the feature into the official codebase, the maintainer pulls the contributor’s changes into their local repository, checks to make sure it doesn’t break the project, merges it into his local master branch, then pushes the master branch to the official repository on the server. The contribution is now part of the project, and other developers should pull from the official repository to synchronize their local repositories


Workflows in TFS

Feature Branch Workflow for small Teams

It is similar to feature branch workflow in Git.

TFS Branch Workflow for Large Teams.

It is similar to Git workflow in TFS.

Due to centralized development nature of TFS, it has a drawback of developers to continuously connect to network to carry out the development. So if someone has to develop something off the network, it is bit difficult.

Also due to distributed development nature in GIT, it has another advantage to create branches in fraction of seconds comparing to TFS where every time a new branch is created, it has to be created first in TFS central server and then it should be downloaded to local machine.

Also team working remotely has advantages in GIT where they can do source control operation pretty fast because of its distributed development nature.


Leave a Reply

Your email address will not be published. Required fields are marked *