When working with Git, I find myself frequently typing “git status” - a useful command that shows me on which branch I am working and the number of uncommitted files that have been changed, added, and deleted. An example is shown in Fig. 1:

gp01-gitstatus
Fig. 1

As you can see, I am working on the "dgiard/posh-git-demo" branch, I have added 1 file, deleted 1 file, and changed 1 file since my last commit.

But what if I could always see this information? What if was appended to the command line, so I never had to type "git status"?

The posh-git tool provides exactly this functionality.

To install posh-git, run Windows PowerShell as an administrator.

At the PowerShell command prompt, enter  

PowerShellGet\Install-Module posh-git

and press "Y" when prompted for confirmation.

Then, enter the command 

import-module posh-git

Your command prompt will change to something like the one shown in Fig. 2.

gp02-gitposhPsPrompt
Fig. 2

Notice the text in square brackets after the path. It lists the current branch no which I am working, followed by the number of files I have added, changed, or deleted (if any) since my last commit. The red text, indicates these changes not been added to my git rep repository. If I issue a "git add", the text will change to green to indicate they are ready to commit, as shown in Fig. 3.

gp03-added
Fig. 3

After I commit the files, I only see my current branch and no uncommitted files, as shown in Fig. 4.

gp04-commit
Fig. 4

Of course, I can get more details by typing "git status"; but most of the time, this is all the information I need.


Thank you to Hattan for showing me this tool.