Get Git status in PowerShell

A script that queries every subdirectory of the current directory, checking for untracked or modified files, as well as updates in a remote source.

For example, running it in the bundles dir (home to a number of Vim addins):

> . gitStat.ps1
—————————————
Checking for local changes
—————————————
AutoComplPop
    No modified files
iceberg.vim
    C:\Users\vim\vimfiles\bundle\iceberg.vim has modified files

neomru.vim
    C:\Users\vim\vimfiles\bundle\neomru.vim has untracked files

nerdcommenter
    No modified files
snipmate.vim
    C:\Users\vim\vimfiles\bundle\snipmate.vim has untracked files

—————————————
Checking for remote changes
—————————————

unite-outline

unite.vim
    C:\Users\vim\vimfiles\bundle\unite.vim has updates available

vim-airline
    C:\Users\vim\vimfiles\bundle\vim-airline has updates available

vim-twilight

Similarly, I organize my local projects based on the remote repository:
C:\
+—bitbucket
| +—Clock
| +—enterprisewfp
| +—prismpomo
| +—psconfig
| +—rx1console
+—github
| +—Sample-ShoppingWeb
+—VisualStudioOnline
|  +—LoadTestExp
|  +—TFSTToolsExp

Very handy to cd to c:\work\bitbucket (for example),  run gitstat.ps1, and find out what projects are ahead and what projects are behind the remote repository.

Built with and run in PowerShell v4.0; not tested in previous versions.

gitstat

(I’d be interested in any improvements anyone comes up with…)

Leave a Reply

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

Are you human? * Time limit is exhausted. Please reload CAPTCHA.

Protected with IP Blacklist CloudIP Blacklist Cloud