{"id":1437,"date":"2019-10-27T21:24:48","date_gmt":"2019-10-27T21:24:48","guid":{"rendered":"https:\/\/www.ciraltos.com\/?p=1437"},"modified":"2023-03-23T22:43:22","modified_gmt":"2023-03-24T03:43:22","slug":"git-and-vs-code-for-the-lone-scripter","status":"publish","type":"post","link":"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/","title":{"rendered":"Git and VS Code for the Lone Scripter"},"content":{"rendered":"\n<figure class=\"wp-block-image alignleft is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/VSGit.png\" alt=\"\" class=\"wp-image-1456\" width=\"200\" height=\"200\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/VSGit.png 400w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/VSGit-150x150.png 150w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/VSGit-300x300.png 300w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/><\/figure>\n\n\n\n<p>This is where my last two articles, <a rel=\"noreferrer noopener\" aria-label=\"Git for System Admin Scripting (opens in a new tab)\" href=\"https:\/\/www.ciraltos.com\/git-for-system-admin-scripting\/\" target=\"_blank\">Git for System Admin Scripting<\/a> and <a rel=\"noreferrer noopener\" aria-label=\"Get Started with Git Remote (opens in a new tab)\" href=\"https:\/\/www.ciraltos.com\/get-started-with-git-remote\/\" target=\"_blank\">Get Started with Git Remote<\/a>, come together.&nbsp; Microsoft\u2019s Visual Studio Code (VS Code) is a powerful and extendable IDE. &nbsp;VS Code supports Git out of the box.&nbsp; It also supports many programming and scripting languages with Microsoft and 3<sup>rd<\/sup> party extensions.&nbsp; In this article, I walk through common tasks that we have already covered, only this time with the native Git integration within VS Code.&nbsp;  I also review new functionality with a free 3rd party extension. <\/p>\n\n\n\n<!--more-->\n\n\n\n<p>If you haven\u2019t used VS Code already, it can be downloaded and installed from <a href=\"https:\/\/code.visualstudio.com\/Download#\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\">here<\/a>.&nbsp; I recommend the <em>User installer<\/em> if using Windows.&nbsp; I suspect there are other wonderful IDE\u2019s with Git integration available. If you have another product with similar functionality you prefer, please let me know.&nbsp; Leave a message in the comments below of what it is and why you like it.<\/p>\n\n\n\n<p>This article assumes the reader has basic knowledge of Git covered\nin my previous two articles.&nbsp; In addition,\nyou will need VS Code and Git Bash installed along with a GitHub account.&nbsp; Let\u2019s jump right into using Git and VS Code.<\/p>\n\n\n\n<h2>Git Clone<\/h2>\n\n\n\n<p>I rarely initiate a repository on a local machine.&nbsp; I typically start a new project from the remote repository, GitHub in this case.&nbsp; This way I can create the README.md, and .gitignore files as well as set it as private or public.&nbsp; Once you have the repository setup, go to the green button labeled <em>Clone or Download<\/em>.&nbsp; Copy the web URL for the repository, this is needed shortly. <\/p>\n\n\n\n<p>Now go to VS Code.&nbsp; I\u2019m\ngoing to clone a private repository to my local machine.&nbsp; Start at the command pallet in VS Code by\npressing Ctrl+Shift+P (Command+Shift+P on Mac) and type the command: <em>Git: Clone<\/em> and press enter.&nbsp; As you can imagine, this starts the Git Clone\nprocess.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Command-Git-Clone.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"890\" height=\"291\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Command-Git-Clone.png\" alt=\"\" class=\"wp-image-1438\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Command-Git-Clone.png 890w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Command-Git-Clone-300x98.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Command-Git-Clone-768x251.png 768w\" sizes=\"(max-width: 890px) 100vw, 890px\" \/><\/a><figcaption class=\"wp-element-caption\"> Command Git Clone <\/figcaption><\/figure>\n\n\n\n<p>The next step asks for the Repository URL that was copied to\nthe clipboard a couple of paragraphs ago.&nbsp;\nPaste it into the Command Pallet and hit enter to continue. &nbsp;You may get a login prompt for the GitHub\naccount if you haven\u2019t already logged in.&nbsp;\n<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Command-Git-Clone-URL.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"856\" height=\"222\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Command-Git-Clone-URL.png\" alt=\"\" class=\"wp-image-1439\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Command-Git-Clone-URL.png 856w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Command-Git-Clone-URL-300x78.png 300w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Command-Git-Clone-URL-768x199.png 768w\" sizes=\"(max-width: 856px) 100vw, 856px\" \/><\/a><figcaption class=\"wp-element-caption\"> Command Git Clone URL <\/figcaption><\/figure>\n\n\n\n<p>Next, VS Code will prompt for a location.&nbsp; This is the most confusing part of the\nprocess.&nbsp; VS Code is not prompting for\nthe location of the repository files, it\u2019s prompting for a location to create a\nfolder for the repository.&nbsp; For example,\nI select my GitHub folder, and VS Code creates a new folder in that directory\nwith the name of the repository.&nbsp;\nConfiguration and code files are located in that folder.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Select-Repository-Location.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"684\" height=\"360\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Select-Repository-Location.png\" alt=\"\" class=\"wp-image-1440\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Select-Repository-Location.png 684w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Select-Repository-Location-300x158.png 300w\" sizes=\"(max-width: 684px) 100vw, 684px\" \/><\/a><figcaption class=\"wp-element-caption\"> Select Repository Location <\/figcaption><\/figure>\n\n\n\n<p>Once added, you are asked to open the workspace or add it to\nthe existing workspace.&nbsp; Either is fine,\nI prefer to open the workspace.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Open-Repository.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"462\" height=\"115\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Open-Repository.png\" alt=\"\" class=\"wp-image-1441\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Open-Repository.png 462w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Open-Repository-300x75.png 300w\" sizes=\"(max-width: 462px) 100vw, 462px\" \/><\/a><figcaption class=\"wp-element-caption\"> Open Repository <\/figcaption><\/figure>\n\n\n\n<p>That\u2019s all it takes to clone the repository.&nbsp; VS Code displays the files in the folder\nunder Explorer.&nbsp; Open one of the files,\nmake a change and save it.&nbsp; You may\nnotice that the file icon on the top left has a \u201c1\u201d in a blue circle next to\nit.&nbsp; That indicates one file has been\nchanged and not saved.&nbsp; Save the file and\nthe blue \u201c1\u201d will go away.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Unsaved-File.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"564\" height=\"292\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Unsaved-File.png\" alt=\"\" class=\"wp-image-1442\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Unsaved-File.png 564w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Unsaved-File-300x155.png 300w\" sizes=\"(max-width: 564px) 100vw, 564px\" \/><\/a><figcaption class=\"wp-element-caption\"> Unsaved File <\/figcaption><\/figure>\n\n\n\n<h2>Git Commit<\/h2>\n\n\n\n<p>If you are following along, you may have noticed that the blue \u201c1\u201d moved from the file icon to an icon with three dots connected by two lines.&nbsp; That is the icon for source control and indicates that there is a change that has not been committed yet.&nbsp; This is a convenient reminder of file commit status.&nbsp; When ready to commit, go to the Source Control section and stage the files.&nbsp; This is done by hovering over the file name and clicking the + sign as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Save-Changes.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Save-Changes.png\" alt=\"\" class=\"wp-image-1443\"\/><\/a><figcaption class=\"wp-element-caption\"> Stage Changes <\/figcaption><\/figure>\n\n\n\n<p>Alternatively, if there are multiple files, hover over <em>Changes<\/em>\nand click the + sign to add all.&nbsp; These\ntwo steps are the same as running the <em>git add <\/em>or <em>git add<\/em> &#8211;<em>A<\/em>\ncommand.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Save-All-Changes.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"567\" height=\"226\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Save-All-Changes.png\" alt=\"\" class=\"wp-image-1444\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Save-All-Changes.png 567w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Save-All-Changes-300x120.png 300w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/a><figcaption class=\"wp-element-caption\"> Save All Changes <\/figcaption><\/figure>\n\n\n\n<p>Next is the Commit.&nbsp;\nVS Code provides a location to enter a message.&nbsp; Once a message is entered, click the checkmark\nto commit the changes. This does the same as the <em>git commit<\/em> command.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Git-Commit.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"555\" height=\"241\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Git-Commit.png\" alt=\"\" class=\"wp-image-1445\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Git-Commit.png 555w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Git-Commit-300x130.png 300w\" sizes=\"(max-width: 555px) 100vw, 555px\" \/><\/a><figcaption class=\"wp-element-caption\"> Git Commit <\/figcaption><\/figure>\n\n\n\n<h2>Git Push and Git Pull<\/h2>\n\n\n\n<p>So far, changes have been made to a file, and the file has\nbeen staged and committed with VS Code.&nbsp; However,\nthe online repository does not reflect any of those changes yet.&nbsp; For that, we need to push the changes to the\nremote repository.&nbsp; To push the changes, click\non the three dots in Source Control.&nbsp; A drop-down\nlist displays with multiple options.&nbsp;\nClick on <em>Push<\/em> to push the file to the remote repository.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Git-Push-and-Pull.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"512\" height=\"355\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Git-Push-and-Pull.png\" alt=\"\" class=\"wp-image-1446\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Git-Push-and-Pull.png 512w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Git-Push-and-Pull-300x208.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption class=\"wp-element-caption\"> Git Push and Pull <\/figcaption><\/figure>\n\n\n\n<p>The last commit is now visible in the remote GitHub\nrepository under commit history.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Commit-from-VS-Code.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"381\" height=\"268\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Commit-from-VS-Code.png\" alt=\"\" class=\"wp-image-1447\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Commit-from-VS-Code.png 381w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Commit-from-VS-Code-300x211.png 300w\" sizes=\"(max-width: 381px) 100vw, 381px\" \/><\/a><figcaption class=\"wp-element-caption\"> Commit from VS Code <\/figcaption><\/figure>\n\n\n\n<p>Notice the drop-down also had the <em>Pull<\/em> option.&nbsp; This works the same as the <em>git pull<\/em>\ncommand, copying remote changes down to the local copy of the repository.&nbsp; The process to initiate a Pull and a Push is\nthe same in VS Code.<\/p>\n\n\n\n<h2>Git Lens<\/h2>\n\n\n\n<p>Next, functionality is added to VS Code with an extension called\nGit Lens.&nbsp; To install, go to the Extensions\npanel in VS Code.&nbsp; The Extensions icon\nhas 4 squares that make up another square (see below).&nbsp; Search for Git Lens and click the green <em>Install\n<\/em>button to get Git Lens.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Install-Git-Lens.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"397\" height=\"325\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Install-Git-Lens.png\" alt=\"\" class=\"wp-image-1448\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Install-Git-Lens.png 397w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Install-Git-Lens-300x246.png 300w\" sizes=\"(max-width: 397px) 100vw, 397px\" \/><\/a><figcaption class=\"wp-element-caption\"> Install Git Lens <\/figcaption><\/figure>\n\n\n\n<h3>View Change Log<\/h3>\n\n\n\n<p>Once Git Lens is installed, go back to a file in the repository\nand click on a line.&nbsp; Notice in very\nlight text there is a message indicating who made the last change, when it was\nchanged, and the commit message.&nbsp; This is\ndata Git Lens pulls from the. git folder about the last commit. &nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Change-Log.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" width=\"649\" height=\"197\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Change-Log.png\" alt=\"\" class=\"wp-image-1449\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Change-Log.png 649w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/10\/Change-Log-300x91.png 300w\" sizes=\"(max-width: 649px) 100vw, 649px\" \/><\/a><figcaption class=\"wp-element-caption\"> Change Log <\/figcaption><\/figure>\n\n\n\n<h3>View Past Versions<\/h3>\n\n\n\n<p>I demonstrated how to view the contents of a file from a previous commit in my first article in this series.&nbsp; That was good, but it would be difficult to identify changes in large files.&nbsp; Below I use Git Lens to do a side-by-side comparison of a file and a previous commit.<\/p>\n\n\n\n<p>Make sure a file with committed changes is open and selected\nin the VS Code editor.&nbsp; Go to the Git\nLens Icon (see below).&nbsp; Under File\nhistory, click on one of the commits to the file.&nbsp; VS Code opens the previously committed file\nand compares it with the current version.&nbsp;\nContent added is highlighted in green and deleted lines are indicated in\nred.&nbsp; This is incredibly helpful for identifying\nchanges in versions of a script.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/View-Past-Versions.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/View-Past-Versions-1024x355.png\" alt=\"\" class=\"wp-image-1450\"\/><\/a><figcaption class=\"wp-element-caption\"> View Past Versions <\/figcaption><\/figure>\n\n\n\n<h2>Summary<\/h2>\n\n\n\n<p>I have used VS Code and GitHub as a source code repository for PowerShell Scripts, ARM templates and Terraform files for over two years.&nbsp; While a file share, USB drive or cloud storage may be okay for storing scripts, I hope you understand why Git is the best option available for code management, even for System Admins and lone scripters.&nbsp; <\/p>\n\n\n\n<p>This series was intentionally limited to features of VS Code and Git that I use and believe other System Admins and Lone Scripters may find helpful.&nbsp; If you have any additional information, tools or processes that may help lone scripters with VS Code and Git, please let everyone know in the comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is where my last two articles, Git for System Admin Scripting and Get Started with Git Remote, come together.&nbsp; Microsoft\u2019s Visual Studio Code (VS Code) is a powerful and extendable IDE. &nbsp;VS Code supports Git out of the box.&nbsp; It also supports many programming and scripting languages with Microsoft and 3rd party extensions.&nbsp; In &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/\"> <span class=\"screen-reader-text\">Git and VS Code for the Lone Scripter<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":3976,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[170,8],"tags":[582,583,230,210,579,341,338,20,340,68],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Git and VS Code for the Lone Scripter - ciraltos<\/title>\n<meta name=\"description\" content=\"In this article, I walk through common Git code management tasks with the native Git integration within VS Code. I also cover using Git Lens to view change logs and previous file versions.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git and VS Code for the Lone Scripter - ciraltos\" \/>\n<meta property=\"og:description\" content=\"In this article, I walk through common Git code management tasks with the native Git integration within VS Code. I also cover using Git Lens to view change logs and previous file versions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/\" \/>\n<meta property=\"og:site_name\" content=\"ciraltos\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-27T21:24:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-24T03:43:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/VSGit.png\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Travis Roberts\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:site\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Travis Roberts\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/\"},\"author\":{\"name\":\"Travis Roberts\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"headline\":\"Git and VS Code for the Lone Scripter\",\"datePublished\":\"2019-10-27T21:24:48+00:00\",\"dateModified\":\"2023-03-24T03:43:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/\"},\"wordCount\":1286,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"keywords\":[\".bat file\",\".ps1 file\",\"Automation\",\"Azure Automation\",\"Bash\",\"git\",\"github\",\"Powershell\",\"runbooks\",\"script\"],\"articleSection\":[\"PowerShell\",\"Trends\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/\",\"name\":\"Git and VS Code for the Lone Scripter - ciraltos\",\"isPartOf\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\"},\"datePublished\":\"2019-10-27T21:24:48+00:00\",\"dateModified\":\"2023-03-24T03:43:22+00:00\",\"description\":\"In this article, I walk through common Git code management tasks with the native Git integration within VS Code. I also cover using Git Lens to view change logs and previous file versions.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.ciraltos.com\/staging2\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Git and VS Code for the Lone Scripter\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\",\"url\":\"http:\/\/www.ciraltos.com\/staging2\/\",\"name\":\"ciraltos\",\"description\":\"cloud, technology and trends\",\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\",\"name\":\"Travis Roberts\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"contentUrl\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"width\":5657,\"height\":3563,\"caption\":\"Travis Roberts\"},\"logo\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/www.ciraltos.com\",\"https:\/\/twitter.com\/ciraltos\"],\"url\":\"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Git and VS Code for the Lone Scripter - ciraltos","description":"In this article, I walk through common Git code management tasks with the native Git integration within VS Code. I also cover using Git Lens to view change logs and previous file versions.","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:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/","og_locale":"en_US","og_type":"article","og_title":"Git and VS Code for the Lone Scripter - ciraltos","og_description":"In this article, I walk through common Git code management tasks with the native Git integration within VS Code. I also cover using Git Lens to view change logs and previous file versions.","og_url":"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/","og_site_name":"ciraltos","article_published_time":"2019-10-27T21:24:48+00:00","article_modified_time":"2023-03-24T03:43:22+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/VSGit.png","type":"image\/png"}],"author":"Travis Roberts","twitter_card":"summary_large_image","twitter_creator":"@ciraltos","twitter_site":"@ciraltos","twitter_misc":{"Written by":"Travis Roberts","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/#article","isPartOf":{"@id":"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/"},"author":{"name":"Travis Roberts","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"headline":"Git and VS Code for the Lone Scripter","datePublished":"2019-10-27T21:24:48+00:00","dateModified":"2023-03-24T03:43:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/"},"wordCount":1286,"commentCount":0,"publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"keywords":[".bat file",".ps1 file","Automation","Azure Automation","Bash","git","github","Powershell","runbooks","script"],"articleSection":["PowerShell","Trends"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/","url":"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/","name":"Git and VS Code for the Lone Scripter - ciraltos","isPartOf":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#website"},"datePublished":"2019-10-27T21:24:48+00:00","dateModified":"2023-03-24T03:43:22+00:00","description":"In this article, I walk through common Git code management tasks with the native Git integration within VS Code. I also cover using Git Lens to view change logs and previous file versions.","breadcrumb":{"@id":"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.ciraltos.com\/staging2\/git-and-vs-code-for-the-lone-scripter\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.ciraltos.com\/staging2\/"},{"@type":"ListItem","position":2,"name":"Git and VS Code for the Lone Scripter"}]},{"@type":"WebSite","@id":"http:\/\/www.ciraltos.com\/staging2\/#website","url":"http:\/\/www.ciraltos.com\/staging2\/","name":"ciraltos","description":"cloud, technology and trends","publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a","name":"Travis Roberts","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/","url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","contentUrl":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","width":5657,"height":3563,"caption":"Travis Roberts"},"logo":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/www.ciraltos.com","https:\/\/twitter.com\/ciraltos"],"url":"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/1437"}],"collection":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/comments?post=1437"}],"version-history":[{"count":6,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/1437\/revisions"}],"predecessor-version":[{"id":3986,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/1437\/revisions\/3986"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media\/3976"}],"wp:attachment":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media?parent=1437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/categories?post=1437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/tags?post=1437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}