Category: Software Configuration Management

Git with Posh-Git, simplifying setup

Git has become one of the most popular source control systems. Thousands of enterprises are using Git for source control management. There are several reasons why Git is a compelling tool to consider for source control. Git being a distributed version control system, the central copy of the code is replicated as a local repository in the work space of the local machine. This facilitates working in offline mode with faster branching, history etc. which are otherwise expensive operations in Centralized repository systems like TFVC or Subversion.  It has extensive integration with many tools like Project Management tools, Build Automation tools and other surrounding tools for ALM and DevOps. Microsoft offers Git as a source control option along with TFVC as part of VSTS and TFS.

Knowledge of Git helps even if that’s not the version control being used for one’s work projects. One can go create public repositories for Open source work, or download / fork other public repositories and contribute to them. Git and GitHub are a great option to source control personal projects.

Many times, it may become a bit of a challenging transition to use Git if one is used to TFVC as a source control on WIndows. TFVC is so much a GUI based tool where Git is best used via command line. Git’s origins are in Linux based systems, and it’s client interfaces were designed to be used in Linux systems. Hence for Windows based development, to use Git as a Source control system, the setup is not as straightforward to understand. While there are many websites which go through setting up Git from scratch on Windows, this is an attempt to explain the steps in more detail so setting up Git for command line use is better understood and it’s easier to cross that initial hump.

Also, Git is best used with command line, since it has been designed that way. For Windows, use Posh-Git which provides an excellent command line interface. Here are the detailed steps for setting up Git and Posh-Git so Git can be used with command line.

1.Install Git for Windows from the website

Choose the below option from the Wizard. This will allow you to install Git Bash and Posh-Git.


Git Bash is an application for Microsoft Windows environments which provides an emulation layer for a Git command line experience. Bash is an acronym for Bourne Again Shell.  Bash is a popular default shell on Linux and macOS. Git Bash is a package that installs Bash, some common bash utilities, and Git on a Windows operating system.

However, it is recommended to use Git with Posh-Git. It’s a PowerShell environment for Git. It’s an open source project hosted on GitHub. Here is the Post-Git GitHub link.

Excerpt from the Post-Git Github site about what Posh-Git offers for Git:

“posh-git is a PowerShell module that integrates Git and PowerShell by providing Git status summary information that can be displayed in the PowerShell prompt, e.g.:

C:\Users\Keith\GitHub\posh-git [master ≡ +0 ~1 -0 | +0 ~1 -0 !]>

posh-git also provides tab completion support for common git commands, branch names, paths and more. For example, with posh-git, PowerShell can tab complete git commands like checkout by typing git ch and pressing the tab key. That will tab complete to git checkout and if you keep pressing tab, it will cycle through other command matches such as cherry and cherry-pick. You can also tab complete remote names and branch names e.g.: git pull or<tab> ma<tab> tab completes to git pull origin master.

Just to clarify, Git will work both through Git Bash and Posh-Git. However Posh-Git has a better interface which we will show later towards the end of the article.

After Git for Windows installation is completed,

2. Now you need to install Post-Git to be able to use Git from PowerShell.

While all instructions are there on the posh-git GitHub website, below are detailed step by step instructions for easier navigation through all the steps:

Open PowerShell as administrator.

Set Execution Policy to RemoteSigned so Posh-Git can be safely downloaded. Basically  RemoteSigned execution policy protects from running unsigned PowerShell scripts downloaded from the internet.


Now download and install posh-git. Run the below command.

PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force

This may give a AllowPrerelease parameter is not recognized error as below:

PowerShell PostGit install command

If the AllowPrerelease parameter is not recognized, update your version of PowerShellGet to >= 1.6 e.g. #

Install-Module PowerShellGet -Scope CurrentUser -Force -AllowClobber


Once again run the command to get Posh-Git as below.

Install Posh-Git

3. After you have installed posh-git, you need to configure your PowerShell session to use the posh-git module. 

The first step is to import the module into your PowerShell session which will enable git tab completion. You can do this with the command:

Import-Module posh-git

This will  manually execute the Import-Module command every time you open a new PowerShell prompt. It’s better if posh-git to be available in all PowerShell hosts (console, ISE, etc).

For that purpose, execute 

Add-PoshGitToProfile -AllHosts.

This will add a line containing Import-Module posh-git to the file $profile.CurrentUserAllHosts.


Check the entry to import module exists powershell profile script by executing the below command in power shell:


4. Check Git Version in Power Shell :

PowerShell GitVersion

Now , Git can be used with Power Shell and Posh-Git. A project can be created and GitHub can be used as a remote repository. It can be used with Git Bash as well, however it is recommended to keep the Posh-Git as primary CLI and Git-Bash can be the secondary CLI.

To illustrate one example how Posh-Git and Git Bash command line interfaces compare, and why Posh-Git is considered better- see below diagram where for a ‘test’ Git project how the ‘master’ branch shows up where two files have been added to the branch. Posh-Git clearly displays the 2 files added.

The Git websites cover many of the Git commands to set up initial projects very well. Learning the Git commands at the Git website and using other online tools will help in becoming further very comfortable with Git.

Continuous Integration : the Value Proposition

The topic of Continuous Integration  has gained a lot of ground in the past few years in the Software Development world – several high quality tools have emerged . Some companies have adopted it as integral part of SDLC methodology. Some I think are still trying to understand it , however a lot have not yet just made it their daily practice due to either lack of tools within the company or lack of a process. I have worked in this industry for more than 20 years and there are several reasons why I think CI adds immense value to software development process to make it efficient and productive. After going through many sucessful and some unsuccessful projects , here is how I conclude CI brings in value:

1 ) Bugs are detected on a daily / regular basis and remedied right away by integrating code checked in by different developers into Source Control . Continuous Integration works by kicking off a build process on your build server based on check-ins made by the team . CI tools give you the option to build as a check-in is made or at a certain frequency or at a certain time etc. So you get to control how you go about it. If a Build is required to be done as a check-in is done by a developer , right away bugs / integration problems get detected – they are remedied as you go along daily, reducing many integration hassles and mitigating risks earlier.

2) In medium to large scale projects there are different groups , stake holders . DBAs who work in conjunction with Application Developers sometimes want to look at GUI or application in action to see what type of data was entered that caused a SQL / Stored Procedure to fail. Although DBAs don’t necessarily need to look at application running in Dev Integration server to detect data related problems , however it gives them a great way to Visualize what an application developer has to say about why a SQL exception may have occured. It expedites problem detection by running the application as well as other runtime SQL method call capture tools like SQL Profiler concurrently.

3) A little while ago I wrote a blog about how the gap between UX Designers and Developers can be bridged by following certain practices with the development cycle. Continuous Integration can play a key role in shortening the gap : UX Designers often or almost always need to see the final integrated UI after the UI developers take UX designer’s Mocks / CSS / Javascript and integtrate their code with it. If you have a CI in place the UX designer can just go to the dev server and look at the latest dev build helping him see how the final UI looks without having to sit next to the developer. Obvious as it is , this will aid in UI layout related debugging and early detection of any cosmetic problems as well as work flow related issues.

4) Progress Track and Control are an integral part of Project Management and SDLC. PMs , BAs and Management stake holders need to be kept in the loop as regularly as possible for better Control management of any software project. A great way to measure development progress by non technical groups is to look at the actual application taking shape on the Dev Build server. Needless to say how this will help very early in the Iteration of a project. Any problems , risks or change requirements can be made early on saving time and money which are the two crucial cornerstones for a Project’s success.

5) In this age of globalization and distributed enterprise , CI can play a crucial role in bringing different groups together . Developers could be in India , UX team could be in US and other stake holders could be anywhere. If dev build servers can be accessed via the company Intranet or VPN from anywhere then the communication and collaboration gap is not widened by geographical distances and Project can be delivered on time even with a distributed arrangement like this. Here is a diagram that visually conveys the idea….

Continuous Integration Integration with Project Team
Entire Team Interaction with CI

The reasons above qualify enough for every organization to adopt and invest in CI – especially for medium to large projects . There are several tools available – form Open Source to Proprietory . Cruise Control is a well know open source tool as welll as TFS by Microsoft which ia an end-to-end SDLC tool. These are just examples. Web is full of articles, blogs and tools that you can use for CI. If you have not taken the time to integrate it into your team’s dev process , wait no more it’s worth your while and money.

Cruise Control

TFS : Make the most of it

The decision to buy TFS or Team Foundation Server is not an easy one ; it’s an expensive product, although Microsoft has introduced TFS Basic as of this writing , however several larger organizations with budgets have already invested in the TFS full version. Interestingly enough , where I was before I worked for different groups who all used TFS , but barely tapped it’s potential. TFS almost immediately gets adopted as a Source Control because of  it’s  containment inside Visual Studio IDE. It easily becomes a developer’s everyday tool where developers use it for Source Control as well as Continuous Integration. The Continuous Integration support works off of the IDE again and you need not use any other tool to configure it. The only other configuration that happens is on the Server side where you are hosting the Team Foundation Build Service. So , this is still in the Developer’s paradigm or a Build Master who interacts directly with Developers.

However , this is barely any use of what TFS can offer – TFS is an End To End SDLC tool which can be used for the entire Life Cycle Management of the Project by all team members without having to use anything else. Team members include non developers like Business Analysts, Project Managers , Testers , End Users and other Stake Holders. However the problem with all these non developers using TFS comes with TFS client being Team Explorer which installs a shell of Visual Studio and uses the Visual Studio interface for TFS connectivity . This can turn off a lot of non developers in the team from using it because most of these people are not used to having Visual Studio as an application on their machines.Even the Developers ended up not making full use of it because Project Managers or BAs don’t use it where Requirements and Work Items can be created, against which development can be done and tracked.

If your organization has already invested in TFS , I think you must make a dedicated effort in getting everyone to make use of it so the entire SDLC can be managed efficiently with just one tool.  This blog is not meant to be an advertisement for TFS : the idea is if you have chosen to invest in TFS , get most on your investment by getting the Team to use it as SDLC tool so you get the right value for your money. TFS integrates with Sharepoint and MS Project Manager – two very popular enterprise Project Management and Collaboration tools. The adjustment needs to happen mainly in installing the Team Explorer client which is Visual Studio GUI interface . I have used VS 2008 Team system and started using the 2010. Team Explorer for 2008 is free and a seperate install. Once that’s done you can connect to TFS server and your Team’s project and  manage everything from there itself.

We used TFS for our entire cycle as well as Post Production support for one of our projects. One major issue we found was we had our customers create issues in Sharepoint site of the Team Project . As of this writing the 2008 version lacked a good integration where the Work Items or Issues created by Sharepoint users could not be easily imported into the Visual Studio client interface. We had to Excel export the Sharepoint items and then import them back into Team explorer through Excel, which is a kind of round about way to achieve something that could have been offered as simple one click function from the tool itself. I am not sure if they fixed this in the newer 2010 version , if so then completes the product without any holes for SDLC management.

PS: we used TFS for all of our .Net projects . I know that TFS can be used with other stacks as well , like Java for example – however not sure if the Continuous Integartion would work correctly for Java because TFS Build engine uses MSBuild and the .Proj files to make builds. Anyways if you are a MS shop with .Net projects then TFS is definitely a great project management and collaboration tool.