{"id":6465,"date":"2019-01-28T12:10:13","date_gmt":"2019-01-28T17:10:13","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=6465"},"modified":"2019-01-29T08:28:44","modified_gmt":"2019-01-29T13:28:44","slug":"keeping-git-in-check-with-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/","title":{"rendered":"Keeping Git in Check with PowerShell"},"content":{"rendered":"<p>Last week on Twitter I saw a discussion about a <em>git<\/em> related problem. The short version of the story is that the person was running out of disk space and didn't understand why. Turns out this person has several development projects using <em>git<\/em>. All of the change tracking and other related activities are stored in a hidden .git folder. The amount of data in this folder had gotten out of hand. This is not necessarily unexpected behavior. In fact, you can, and should, periodically run <a title=\"read online help for this process\" href=\"https:\/\/git-scm.com\/docs\/git-gc\" target=\"_blank\" rel=\"blank noopener\">git gc<\/a>\u00a0 to perform basic housekeeping. That part is easy. I have a number of git managed projects. What I was more interested in was determining how big the folder had become. Because <em>git<\/em> uses a hidden folder it is pretty easy to forget about it. I wrote a PowerShell function so that I wouldn't.<\/p>\n<p><!--more--><\/p>\n<h2>The Basics<\/h2>\n<p>When creating any function, I always recommend starting with a command or set of commands that you can run in an interactive session that achieves the essence of your desired goal. In this case, it is pretty simple to get a directory listing of files and determine the total size.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">Get-ChildItem -Path C:\\scripts\\PSScriptTools\\.git -file -Recurse | Measure-Object -Property Length -sum\n<\/pre>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image-24.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; background-image: none;\" title=\"Measuring .git with PowerShell\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-24.png\" alt=\"Measuring .git with PowerShell\" width=\"377\" height=\"201\" border=\"0\" \/><\/a><\/p>\n<p>Now that I know the expression works, I can use it as the basis of my function. I already have full cmdlet and parameter names so that's a plus. Now to think about how I intend to use this.<\/p>\n<p>I know the folder will always be called .git. I will most likely pass a parent directory path and if .git exists, then run the calculations. This means I can define a Path parameter and configure it to accept pipeline input.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">[Parameter(Position = 0, ValueFromPipeline, ValueFromPipelinebyPropertyName)]\n[alias(\"pspath\")]\n[ValidateScript( {Test-Path $_})]\n[string]$Path = \".\"\n<\/pre>\n<p>Notice that I've also created an alias, <em>pspath<\/em>. This is because most of my repositories are under C:\\Scripts and I want to be able to run <em>dir c:\\scripts -directory<\/em> and pipe to my function. Through experience I have found that if I define the <em>pspath<\/em> alias, this works much easier.<\/p>\n<p>With the path in hand, I can construct a path to test.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">$full = Convert-Path -Path $Path\n$git = Join-Path -Path $full -childpath \".git\"\n<\/pre>\n<p>I am converting the path so that I get a full file system path. I set a default value for $path of '.' and I want to be able to convert that to a full file system name. Notice also the use of <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113347\" target=\"_blank\" rel=\"noopener\">Join-Path<\/a>. There is no reason to use concatenation to build paths. It is easy to mess up and personally I see it as a sign of a beginner.<\/p>\n<blockquote><p>Let me point out that the real objective of this article is how I built this function and the techniques I used. The end result is useful but not my goal for this post. There are plenty of git and PowerShell related tools available.<\/p><\/blockquote>\n<h2>Function Output<\/h2>\n<p>When you create a PowerShell function, it should only do one thing and only write one type of object to the pipeline. With this function I decided to create a simple object.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">[PSCustomObject]@{\n    Path  = $full\n    Files = $stat.count\n    Size  = $Size\n} #customobject\n<\/pre>\n<p>I'm only expecting to run this locally so I didn't think I needed a Computername property. I suppose I could have added a DateTime property. That could come in handy if I were logging. I could have grabbed data from git like branches. But that starts veering into a different set of requirements. All I need of this function is an indication of how big the folder is so I know if I need to run <em>git gc<\/em>.<\/p>\n<h2>Plan Ahead<\/h2>\n<p>That said, I added one additional feature to my function. <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113349\" target=\"_blank\" rel=\"noopener\">Measure-Object<\/a> is providing a value in bytes. Well, I'm not very good at quickly telling at a glance if something is 100KB or 100MB. Usually, I would tell people NOT to include any sort of formatting or data manipulation in your function. I could just as easily pipe my output to <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113387\" target=\"_blank\" rel=\"noopener\">Select-Object<\/a> and create a custom property dividing the sum by 1KB, or 1MB. However, I am constantly telling PowerShell toolmakers that you have to think about who is going to use your tool and how.\u00a0 In this case it is me and I know that will most likely want to see the value in something other than bytes. So I added a $As parameter.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">[ValidateSet(\"kb\", \"mb\", \"gb\")]\n[string]$As\n<\/pre>\n<p>Also note that I am using a parameter validation technique. I am limiting parameter choices to these 3 options. Even better, because I'm using ValidateSet, PowerShell will use these values with tab completion!<\/p>\n<h2>The Function<\/h2>\n<p>For now, the complete <a title=\"go to the gist\" href=\"https:\/\/gist.github.com\/jdhitsolutions\/cbdc7118f24ba551a0bb325664415649\" target=\"_blank\" rel=\"blank noopener\">function is up on Github<\/a>.<\/p>\n<p>https:\/\/gist.github.com\/jdhitsolutions\/cbdc7118f24ba551a0bb325664415649<\/p>\n<p>I have some other plans for this function. But for now I can use it to check a single folder.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image-25.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; background-image: none;\" title=\"Getting git size with PowerShell\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-25.png\" alt=\"Getting git size with PowerShell\" width=\"1028\" height=\"617\" border=\"0\" \/><\/a><\/p>\n<p>Or I can check an entire directory.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">dir c:\\scripts -directory | get-gitsize | Out-GridView -Title \"Git Report\"\n<\/pre>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image-26.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; background-image: none;\" title=\"Testing multiple git repositories with PowerShell\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-26.png\" alt=\"Testing multiple git repositories with PowerShell\" width=\"899\" height=\"395\" border=\"0\" \/><\/a><\/p>\n<p>With a little extra effort I could build a simple control script.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">dir c:\\scripts -Directory | Get-GitSize | where-object {$_.size -ge 25MB} |\nOut-GridView -Title \"Select repos to compress\" -PassThru | foreach-object {\nset-location $_.Path\ngit gc --aggressive\n}\n<\/pre>\n<p>You may have other ideas in mind on how to use this. If so, I hope you'll share. Enjoy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week on Twitter I saw a discussion about a git related problem. The short version of the story is that the person was running out of disk space and didn&#8217;t understand why. Turns out this person has several development projects using git. All of the change tracking and other related activities are stored in&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New on the blog: Keeping Git in Check with #PowerShell","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[521,4],"tags":[224,519,534],"class_list":["post-6465","post","type-post","status-publish","format-standard","hentry","category-git","category-powershell","tag-function","tag-git","tag-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Keeping Git in Check with PowerShell &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"See how I keep my git repositories under control with this PowerShell function that tells me how much space git itself is using.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Keeping Git in Check with PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"See how I keep my git repositories under control with this PowerShell function that tells me how much space git itself is using.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-28T17:10:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-01-29T13:28:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-24.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Keeping Git in Check with PowerShell\",\"datePublished\":\"2019-01-28T17:10:13+00:00\",\"dateModified\":\"2019-01-29T13:28:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/\"},\"wordCount\":815,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/image_thumb-24.png\",\"keywords\":[\"Function\",\"Git\",\"PowerShell\"],\"articleSection\":[\"Git\",\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/\",\"name\":\"Keeping Git in Check with PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/image_thumb-24.png\",\"datePublished\":\"2019-01-28T17:10:13+00:00\",\"dateModified\":\"2019-01-29T13:28:44+00:00\",\"description\":\"See how I keep my git repositories under control with this PowerShell function that tells me how much space git itself is using.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/image_thumb-24.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/image_thumb-24.png\",\"width\":377,\"height\":201},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6465\\\/keeping-git-in-check-with-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Git\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/git\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Keeping Git in Check with PowerShell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Keeping Git in Check with PowerShell &#8226; The Lonely Administrator","description":"See how I keep my git repositories under control with this PowerShell function that tells me how much space git itself is using.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Keeping Git in Check with PowerShell &#8226; The Lonely Administrator","og_description":"See how I keep my git repositories under control with this PowerShell function that tells me how much space git itself is using.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2019-01-28T17:10:13+00:00","article_modified_time":"2019-01-29T13:28:44+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-24.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Keeping Git in Check with PowerShell","datePublished":"2019-01-28T17:10:13+00:00","dateModified":"2019-01-29T13:28:44+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/"},"wordCount":815,"commentCount":4,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-24.png","keywords":["Function","Git","PowerShell"],"articleSection":["Git","PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/","name":"Keeping Git in Check with PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-24.png","datePublished":"2019-01-28T17:10:13+00:00","dateModified":"2019-01-29T13:28:44+00:00","description":"See how I keep my git repositories under control with this PowerShell function that tells me how much space git itself is using.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-24.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-24.png","width":377,"height":201},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6465\/keeping-git-in-check-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Git","item":"https:\/\/jdhitsolutions.com\/blog\/category\/git\/"},{"@type":"ListItem","position":2,"name":"Keeping Git in Check with PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":4999,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4999\/finding-git-repositories-with-powershell\/","url_meta":{"origin":6465,"position":0},"title":"Finding Git Repositories with PowerShell","author":"Jeffery Hicks","date":"May 18, 2016","format":false,"excerpt":"As part of my ongoing improvement process this year I am starting to use Git much more. Yesterday I posted an article with my PowerShell script to create a new project folder which includes creating a Git repository. My challenge has been that I don't always remember what I have\u2026","rel":"","context":"In &quot;Git&quot;","block_context":{"text":"Git","link":"https:\/\/jdhitsolutions.com\/blog\/category\/git\/"},"img":{"alt_text":"find git repositories with PowerShell","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/05\/image_thumb-1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/05\/image_thumb-1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/05\/image_thumb-1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":5090,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5090\/friday-fun-git-tip-of-the-day\/","url_meta":{"origin":6465,"position":1},"title":"Friday Fun: Git Tip of the Day","author":"Jeffery Hicks","date":"June 10, 2016","format":false,"excerpt":"This year I've really taken to learning Git and how to incorporate it into my daily work routine. If nothing else this has been a great reminder about what it is like to learn something totally new and foreign. I've learned quite a bit, but am far from considering myself\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"cloning git tips","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-9.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-9.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-9.png?resize=525%2C300 1.5x"},"classes":[]},{"id":5112,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5112\/creating-git-commit-messages-with-powershell\/","url_meta":{"origin":6465,"position":2},"title":"Creating Git Commit Messages with PowerShell","author":"Jeffery Hicks","date":"June 21, 2016","format":false,"excerpt":"As part of my process of learning an using Git I am trying to get in the habit of using meaningful commit messages. Sure, you can get by with a single line comment which is fine when running git log --oneline. But you can use a multi-line commit message. However,\u2026","rel":"","context":"In &quot;Git&quot;","block_context":{"text":"Git","link":"https:\/\/jdhitsolutions.com\/blog\/category\/git\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-19.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-19.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-19.png?resize=525%2C300 1.5x"},"classes":[]},{"id":5633,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5633\/get-git-with-powershell\/","url_meta":{"origin":6465,"position":3},"title":"Get Git with PowerShell","author":"Jeffery Hicks","date":"August 25, 2017","format":false,"excerpt":"If you are creating PowerShell scripts, tools or modules today, you are most likely using Git. What? You're not? Is it because you haven't gotten around to installing it? I have some \"quick and dirty\" PowerShell hacks to help you out on Windows systems. Linux boys and girls already know\u2026","rel":"","context":"In &quot;Git&quot;","block_context":{"text":"Git","link":"https:\/\/jdhitsolutions.com\/blog\/category\/git\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/08\/image_thumb-8.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/08\/image_thumb-8.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/08\/image_thumb-8.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/08\/image_thumb-8.png?resize=700%2C400 2x"},"classes":[]},{"id":5121,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5121\/friday-fun-find-a-git-tip-with-powershell\/","url_meta":{"origin":6465,"position":4},"title":"Friday Fun: Find a Git Tip with PowerShell","author":"Jeffery Hicks","date":"June 24, 2016","format":false,"excerpt":"Recently I published a PowerShell function that I use to display a random Git Tip of the Day. The function relies on my clone of the Git-Tips project on GitHub. I've been keeping tabs on this project and a question was posed about creating a command line utility to search\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"finding a git tip with PowerShell","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-20.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-20.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-20.png?resize=525%2C300 1.5x"},"classes":[]},{"id":5132,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5132\/downloading-git-tips-with-powershell\/","url_meta":{"origin":6465,"position":5},"title":"Downloading Git Tips with PowerShell","author":"Jeffery Hicks","date":"June 27, 2016","format":false,"excerpt":"So I've been sharing a number of PowerShell tools I've created for working with Git, including a few for getting tips from the Git Tips project on GitHub. My initial work was based on the fact that I had a local clone of that repository and wanted to search the\u2026","rel":"","context":"In &quot;Git&quot;","block_context":{"text":"Git","link":"https:\/\/jdhitsolutions.com\/blog\/category\/git\/"},"img":{"alt_text":"getting all online git tips with PowerShell","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-22.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-22.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-22.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/6465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=6465"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/6465\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=6465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=6465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=6465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}