From the cmder website:

Cmder is a software package created out of pure frustration over the absence of nice console emulators on Windows. It is based on amazing software, and spiced up with the Monokai color scheme and a custom prompt layout, looking sexy from the start.

Cmder is my favorite terminal emulator for Windows, and my use has been born out of the benefits it provides over using the standard cmd and powershell terminals.

However, Cmder is a tad spartan when it comes to showing the amount of changes when you’re in a directory holding a Git repository.

Note: this does not apply to powershell terminals.

Showing Git changes

Default behavior

When adding a file and removing a file from the working directory, the terminal prompt shows that something has changed (and on which branch).

adding-and-removing-a-file-default

This could benefit from showing a bit more information. For instance, it would be great if our terminal window would also indicate what has currently been changed.

Improved behavior

Using a gist I found on GitHub, more insight can be gained about the changes in the current working directory.

adding-and-removing-a-file-improved

With the addition of the script, we’re looking at the amount of files changed. Specifically, in green, we see which files have been added (+), modified (~), deleted (-) from the current index (read: staged for commit).

In red, we see the same numbers regarding added, modified and deleted files. These changes are scoped to the currently untracked files in the working directory.

How it works

The following line in the script executes a command using the standard Git command-line tooling:

git -c color.status=false status --short 2>nul

The output of the command is translated into the graphical representation on the command prompt. Look below to see them in action simultaneously.

git-c-and-status-example

How to apply the script

Save the contents of the script into a file (e.g. git_peek.lua).

Find the directory where Cmder is installed, and place the file into /config.

You’re done! The script will be executed when Cmder starts up.

Credits

This script was not written by me and credits go to the original author. I’d like to thank the author for the gist that the above post is based on.