<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>learnings on Cory Knox</title>
    <link>https://coryknox.dev/categories/learnings/</link>
    <description>Recent content in learnings on Cory Knox</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Tue, 12 Nov 2024 00:00:00 +0000</lastBuildDate><atom:link href="https://coryknox.dev/categories/learnings/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>New TIL tag and posts</title>
      <link>https://coryknox.dev/posts/2024/new-til-tag-and-posts/</link>
      <pubDate>Tue, 12 Nov 2024 00:00:00 +0000</pubDate>
      
      <guid>https://coryknox.dev/posts/2024/new-til-tag-and-posts/</guid>
      <description>&lt;p&gt;For a while at Chocolatey, we have had a Slack channel for things we learned.
For almost as long I have been meaning to add a post about the things I learned to my blog.
Recently, &lt;a href=&#34;https://jvns.ca/&#34;&gt;Julia Evans&lt;/a&gt; shared about her creation of a small &lt;a href=&#34;https://jvns.ca/blog/2024/11/09/new-microblog/&#34;&gt;&amp;ldquo;TIL&amp;rdquo; section&lt;/a&gt; on her site.&lt;/p&gt;
&lt;p&gt;With that in mind, I have created a &amp;ldquo;TIL&amp;rdquo; tag on my blog, as well as redirecting &lt;a href=&#34;https://coryknox.dev/til&#34;&gt;https://coryknox.dev/til&lt;/a&gt; to the listing page for the tag.&lt;/p&gt;
&lt;p&gt;Also at Julia&amp;rsquo;s encouragement, I have created a PowerShell script that will create a new page for me and open the file in vscode.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Automatically setup remote tracking branch</title>
      <link>https://coryknox.dev/posts/2024/automatically-setup-remote-tracking-branch/</link>
      <pubDate>Wed, 23 Oct 2024 00:00:00 +0000</pubDate>
      
      <guid>https://coryknox.dev/posts/2024/automatically-setup-remote-tracking-branch/</guid>
      <description>&lt;p&gt;I learned this on &lt;a href=&#34;https://jeffreyfritz.com/&#34;&gt;CSharpFritz&lt;/a&gt;&amp;rsquo;s &lt;a href=&#34;https://twitch.tv/csharpfritz&#34;&gt;stream&lt;/a&gt;: &lt;code&gt;git config --global --add --bool push.autoSetupRemote true&lt;/code&gt;. This allows you to be able to just do &lt;code&gt;git push&lt;/code&gt; and it&amp;rsquo;ll automatically setup a remote tracking branch on your default remote.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Prevent force pushing even when remote is fetched automatically</title>
      <link>https://coryknox.dev/posts/2024/prevent-force-pushing-even-when-remote-is-fetched-automatically/</link>
      <pubDate>Wed, 23 Oct 2024 00:00:00 +0000</pubDate>
      
      <guid>https://coryknox.dev/posts/2024/prevent-force-pushing-even-when-remote-is-fetched-automatically/</guid>
      <description>&lt;p&gt;Today I learned from Scott Chacon about the &lt;code&gt;--force-if-includes&lt;/code&gt; on &lt;code&gt;git push&lt;/code&gt;. When used alongside &lt;code&gt;--force-with-lease&lt;/code&gt; will negate the troubles potentially caused by applications that periodically &lt;code&gt;git fetch&lt;/code&gt; for you. Basically it will prevent you from pushing if you&amp;rsquo;re pushing to a remote that has a commit that is not a common ancestor of what you&amp;rsquo;re pushing I think&amp;hellip; If my testing is correct, then it&amp;rsquo;ll act like &lt;code&gt;--force-with-lease&lt;/code&gt; when the remote has not been fetched down, but in the scenario where it has actually been fetched down. (Source: &lt;a href=&#34;https://git-scm.com/docs/git-push#Documentation/git-push.txt---no-force-if-includes&#34;&gt;https://git-scm.com/docs/git-push#Documentation/git-push.txt---no-force-if-includes&lt;/a&gt;)&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Stash untracked changes in a way that git stash reports them</title>
      <link>https://coryknox.dev/posts/2024/stash-untracked-changes-in-a-way-that-git-stash-reports-them/</link>
      <pubDate>Wed, 23 Oct 2024 00:00:00 +0000</pubDate>
      
      <guid>https://coryknox.dev/posts/2024/stash-untracked-changes-in-a-way-that-git-stash-reports-them/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve learned that you can do &lt;code&gt;git stash -u&lt;/code&gt; to stash untracked files as well as tracked files&amp;hellip; But nothing will show you those files in the stash by default&amp;hellip; Instead, if you do &lt;code&gt;git add &amp;lt;untracked files&amp;gt;&lt;/code&gt; and then &lt;code&gt;git stash&lt;/code&gt;, they are magically tracked files even if they&amp;rsquo;re not actually committed to the repository.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Run PowerShell no matter what</title>
      <link>https://coryknox.dev/posts/2024/run-powershell-no-mater-what/</link>
      <pubDate>Fri, 23 Feb 2024 00:00:00 +0000</pubDate>
      
      <guid>https://coryknox.dev/posts/2024/run-powershell-no-mater-what/</guid>
      <description>&lt;p&gt;VS Code is pretty amazing.
Having the ability to edit virtually all of your files, and launch debugging sessions of them.
But what if you have a codebase that has a &lt;code&gt;.vscode/launch.json&lt;/code&gt; file and want to debug a PowerShell script?&lt;/p&gt;
&lt;p&gt;Unfortunately, by default, &lt;code&gt;F5&lt;/code&gt; will only debug PowerShell if there are no debugger configurations.
This means that pressing &lt;code&gt;F5&lt;/code&gt; will attempt to run the configured debugger for your workspace regardless of if you&amp;rsquo;re in a PowerShell file.&lt;/p&gt;
&lt;p&gt;Fear not!
Although by default you&amp;rsquo;re not able to run PowerShell code with &lt;code&gt;F5&lt;/code&gt; when a debugger configuration exists, you are able to tell VS Code you want to do this!&lt;/p&gt;
&lt;h2 id=&#34;doing-it-through-the-gui&#34;&gt;Doing it through the GUI &lt;a href=&#34;#doing-it-through-the-gui&#34; class=&#34;anchor&#34;&gt;🔗&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;If you&amp;rsquo;d like to add this through the VS Code GUI, you can follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the Keyboard Shortcuts UI (&lt;code&gt;Ctrl + K, Ctrl + S&lt;/code&gt; by default, or search for &lt;code&gt;Preferences: Keyboard Shortcuts&lt;/code&gt; with the Command Palette), then search for &lt;code&gt;PowerShell: Run&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Locate and double click the entry for &lt;code&gt;PowerShell: Run&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;F5&lt;/code&gt; followed by &lt;code&gt;Enter&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Right click the entry and choose &lt;code&gt;Change When Expression&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Enter the following for the expression: &lt;code&gt;editorTextFocus &amp;amp;&amp;amp; debugState == &#39;inactive&#39; &amp;amp;&amp;amp; editorLangId == &#39;powershell&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Bask in the glory that is pressing &lt;code&gt;F5&lt;/code&gt; in a PowerShell script and always having it do what you expect it to do.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;doing-it-through-the-keybindingsjson-file&#34;&gt;Doing it through the &lt;code&gt;keybindings.json&lt;/code&gt; file &lt;a href=&#34;#doing-it-through-the-keybindingsjson-file&#34; class=&#34;anchor&#34;&gt;🔗&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;If you&amp;rsquo;d prefer to just copy/paste something into the settings files, you can add the below to your &lt;code&gt;keybindings.json&lt;/code&gt; file:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nt&#34;&gt;&amp;#34;key&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;f5&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nt&#34;&gt;&amp;#34;command&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;PowerShell.Debug.Start&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nt&#34;&gt;&amp;#34;when&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;editorTextFocus &amp;amp;&amp;amp; debugState == &amp;#39;inactive&amp;#39; &amp;amp;&amp;amp; editorLangId == &amp;#39;powershell&amp;#39;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can locate your &lt;code&gt;keybindings.json&lt;/code&gt; file through the Command Palette &lt;code&gt;Preferences: Open Keyboard Shortcuts (JSON)&lt;/code&gt;.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
