<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Stephen Chiang</title>
    <description>The latest articles on Forem by Stephen Chiang (@chiangs).</description>
    <link>https://forem.com/chiangs</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F49624%2F11e9a1c1-44d1-482e-a9ae-bc7b15687f72.jpg</url>
      <title>Forem: Stephen Chiang</title>
      <link>https://forem.com/chiangs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/chiangs"/>
    <language>en</language>
    <item>
      <title>The escape key; just a vim need?</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Wed, 13 Nov 2019 19:33:21 +0000</pubDate>
      <link>https://forem.com/chiangs/the-escape-key-just-a-vim-need-1165</link>
      <guid>https://forem.com/chiangs/the-escape-key-just-a-vim-need-1165</guid>
      <description>&lt;p&gt;Lately I've been thinking about how I rarely use the esc key and now the new Mac has brought back physical escape keys due to previous criticisms...And I'm wondering...who besides vim users needs that escape key so frequently?&lt;/p&gt;

&lt;p&gt;So please tell me, what are you using that escape key for?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>watercooler</category>
    </item>
    <item>
      <title>VS Code snippet leads to funny, unintentional results. \_(ツ)_/</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Thu, 31 Oct 2019 14:31:34 +0000</pubDate>
      <link>https://forem.com/chiangs/vs-code-snippet-leads-to-funny-unintentional-results---4bg4</link>
      <guid>https://forem.com/chiangs/vs-code-snippet-leads-to-funny-unintentional-results---4bg4</guid>
      <description>&lt;p&gt;A long time ago I decided to create a snippet where if in VS Code I type: &lt;code&gt;:shrug&lt;/code&gt; I get &lt;code&gt;¯\_(ツ)_/¯&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It isn't the &lt;em&gt;most&lt;/em&gt; useful snippet, but fun nonetheless. &lt;/p&gt;

&lt;p&gt;Lately my autocomplete for CSS has been giving me this snippet every time I hit &lt;code&gt;enter&lt;/code&gt; after I start a CSS property. &lt;/p&gt;

&lt;p&gt;So my CSS file is littered with these guys because I hit &lt;code&gt;enter&lt;/code&gt; or &lt;code&gt;tab&lt;/code&gt; for the autocomplete without checking which snippet it's referring to leading to some self-chuckling results.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pScqcXPZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nl0e0kq176mab0koj68c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pScqcXPZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nl0e0kq176mab0koj68c.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are some of your funny accidents or unintentional results from creating your own snippets and shortcuts in code?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>watercooler</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Customizing / Contributing to a VS Code Theme - Syntax Highlighting</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Tue, 08 Oct 2019 20:21:38 +0000</pubDate>
      <link>https://forem.com/chiangs/customizing-contributing-to-a-vs-code-theme-syntax-e01</link>
      <guid>https://forem.com/chiangs/customizing-contributing-to-a-vs-code-theme-syntax-e01</guid>
      <description>&lt;h2&gt;
  
  
  Ever wanted to make your own theme?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Or maybe you found one but is just slightly off from what you prefer.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's also a great, easy way to contribute for Hacktoberfest. In this post, I'm going to show you how to modify syntax highlighting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Backstory
&lt;/h2&gt;

&lt;p&gt;Like many other devs, I use Sarah Drasner's &lt;a href="https://github.com/sdras/night-owl-vscode-theme" rel="noopener noreferrer"&gt;Night Owl Theme&lt;/a&gt;. It looks great with Dank Mono. My one complaint; CSS Custom Properties syntax highlighting wasn't as awesome as the rest of the theming. So I opened an issue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fxoyslt1fchdq98q12c6b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fxoyslt1fchdq98q12c6b.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then I decided I want to take a stab at it, but I had no idea where to start. After forking the repo and opening it up, the JSON for each theme was pretty straightforward, but finding the right scope was like a blind squirrel trying to find a nut...on a long enough timeline I find one, but it's probably not what I was looking for. It was pretty frustrating.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docs
&lt;/h2&gt;

&lt;p&gt;So I went to the following places for documentation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://macromates.com/manual/en/language_grammars#naming_conventions" rel="noopener noreferrer"&gt;Naming Conventions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Useful, but still pretty vague. &lt;/p&gt;

&lt;p&gt;Then I found the golden link: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#scope-inspector" rel="noopener noreferrer"&gt;Visual Studio Scope Inspector&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Scope Inspector
&lt;/h2&gt;

&lt;p&gt;VS Code's built-in scope inspector tool helps debug grammars. It displays the scopes for the token at the current position in a file, along with metadata about which theme rules apply to that token.&lt;/p&gt;

&lt;p&gt;Lovely VS Code has an inspector you can activate from the command palette. 🤯&lt;/p&gt;

&lt;p&gt;Trigger the scope inspector from the Command Palette by selecting the &lt;code&gt;Developer: Inspect TM Scopes&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can look at the docs, but I'll go through the steps here with some visuals:&lt;/p&gt;

&lt;h2&gt;
  
  
  Playing around
&lt;/h2&gt;

&lt;p&gt;One quick and easy way to check my work is to open up my own &lt;code&gt;settings.json&lt;/code&gt; and stub the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"editor.tokenColorCustomizations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"textMateRules"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CSS Custom Property declarations"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"scope"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"foreground"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"#82aaff"&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next I opened up a CSS file where I'm declaring and using CSS variables and highlighted the prop, and I get this lovely view:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Frzvxf6ljl9kpd8n4142x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Frzvxf6ljl9kpd8n4142x.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You'll see all the scopes which apply to that item with the top being most specific. &lt;/p&gt;

&lt;p&gt;I don't want to mess with anything else in Sarah's theme so I only chose the most specific one. I set a color and saved and it automatically updated to show me that it worked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scope"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"variable.css"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also needed to highlight the variable when it's being used so I did the same thing with the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1tokzo54kb0a8fqneav3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1tokzo54kb0a8fqneav3.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scope"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"variable.argument.css"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's what my &lt;code&gt;settings.json&lt;/code&gt; looks like to override the styling for the theme. Just two blocks:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F8doo9eb7ogtg8yxdgk8h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F8doo9eb7ogtg8yxdgk8h.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And the results look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fdv5gjp8s8oe7qt7kmdxc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fdv5gjp8s8oe7qt7kmdxc.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All that's left is to update the relevant portions of the theme json and open a PR, just in time for Hacktoberfest 🍻!&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>Microsoft's new FREE font</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Thu, 19 Sep 2019 20:52:47 +0000</pubDate>
      <link>https://forem.com/chiangs/microsoft-s-new-free-font-409g</link>
      <guid>https://forem.com/chiangs/microsoft-s-new-free-font-409g</guid>
      <description>&lt;p&gt;Microsoft has released a new free monospaced font called &lt;strong&gt;&lt;em&gt;Cascadia Code&lt;/em&gt;&lt;/strong&gt;. Bonus: it supports ligatures!&lt;/p&gt;

&lt;p&gt;It will be released with the new iteration of the Windows Terminal, but they've also released it via a &lt;a href="https://github.com/microsoft/cascadia-code/releases" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Has anyone tried it yet? What do you think? &lt;/p&gt;

&lt;p&gt;Post up a screenshot of it with your editor's theme!&lt;/p&gt;

&lt;p&gt;Here's mine with NightOwl on VS Code: &lt;em&gt;note: For me, Polacode did not format it correctly, so I did the screenshot the old fashioned way.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F80p5ynukuwint3laolc8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F80p5ynukuwint3laolc8.png" alt="Cascadia Code screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And Dank Mono for comparison.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbbwgx34dfor35muo0xc1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbbwgx34dfor35muo0xc1.png" alt="Dank Mono screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Hex, rgba, or hsla?</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Wed, 28 Aug 2019 14:27:56 +0000</pubDate>
      <link>https://forem.com/chiangs/hex-rgba-or-hsla-4ae0</link>
      <guid>https://forem.com/chiangs/hex-rgba-or-hsla-4ae0</guid>
      <description>&lt;p&gt;I was reading an older edition of &lt;strong&gt;&lt;em&gt;Design for Hackers&lt;/em&gt;&lt;/strong&gt; last night and there was a statement that hsl was the latest and greatest due to its easier use compared to hex and it got me thinking...I almost always use rgba, and never really gave it a second thought.&lt;/p&gt;

&lt;p&gt;So do you prefer to use hex, rgba, hsla, or mix them? Why?&lt;/p&gt;

</description>
      <category>css</category>
      <category>discuss</category>
    </item>
    <item>
      <title>🌮 Git 'r done when you're done.</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Tue, 27 Aug 2019 13:03:39 +0000</pubDate>
      <link>https://forem.com/chiangs/git-r-done-when-you-re-done-p5b</link>
      <guid>https://forem.com/chiangs/git-r-done-when-you-re-done-p5b</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Once again&lt;/em&gt;&lt;/strong&gt; I'm waiting for my app to run its tests and build so I thought I'd write another quickie.&lt;/p&gt;

&lt;p&gt;Previously I showed how I wrote a git function for emergencies and I need to &lt;a href="https://dev.to/chiangs/in-case-of-fire-gtfo-30g4"&gt;GTFO&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Today, I want to show you a more common process we all might do if we are working by ourselves or on small-teams.&lt;/p&gt;

&lt;p&gt;When I'm done with a feature branch this is usually the steps I go through:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Assuming I'm at the top level of my directory and I've done &lt;code&gt;git push origin head -u&lt;/code&gt; in the past)&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;feature-branch&lt;span class="o"&gt;}&lt;/span&gt; git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;feature-branch&lt;span class="o"&gt;}&lt;/span&gt; git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Awesome commit msg"&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;feature-branch&lt;span class="o"&gt;}&lt;/span&gt; git push
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;feature-branch&lt;span class="o"&gt;}&lt;/span&gt; git checkout develop
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;develop&lt;span class="o"&gt;}&lt;/span&gt; git merge -
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;develop&lt;span class="o"&gt;}&lt;/span&gt; git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If I want to clean up the merged branch locally and remotely, I would also have to do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;develop&lt;span class="o"&gt;}&lt;/span&gt; git branch &lt;span class="nt"&gt;-d&lt;/span&gt; feature-branch
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;develop&lt;span class="o"&gt;}&lt;/span&gt; git push origin :feature-branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;That's a lot of steps.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's how I make it easier with &lt;code&gt;git done&lt;/code&gt; and &lt;code&gt;git donep&lt;/code&gt;, I actually have an alias setup for &lt;code&gt;git&lt;/code&gt; as &lt;code&gt;g&lt;/code&gt; so I'll be using that from now on:&lt;/p&gt;

&lt;p&gt;I'm going to go into my &lt;code&gt;.gitconfig&lt;/code&gt; and create two new aliases like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;[&lt;span class="n"&gt;alias&lt;/span&gt;]
  &lt;span class="n"&gt;done&lt;/span&gt; = &lt;span class="s2"&gt;""&lt;/span&gt;
  &lt;span class="n"&gt;donep&lt;/span&gt; = &lt;span class="s2"&gt;""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using the same syntax as my &lt;code&gt;g tfo&lt;/code&gt; function I'll create &lt;code&gt;done&lt;/code&gt; first which does the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Merge the branch&lt;/li&gt;
&lt;li&gt;Deletes the local branch&lt;/li&gt;
&lt;li&gt;Deletes the remote branch&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That function looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;done = "!f() { git merge $1 &amp;amp;&amp;amp; git branch -d $1 &amp;amp;&amp;amp; git push origin :$1; }; f"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will notice the &lt;code&gt;$1&lt;/code&gt;. That is a reference to a variable that will be passed in when calling the function which happens to be the branch name. Now, I have tried using &lt;code&gt;-&lt;/code&gt; and &lt;code&gt;@{-1}&lt;/code&gt; but deleting the remote branch part of the function won't accept those as references to the last branch used. So unless a reader here has an idea, I am relegated to passing in the feature branch name specifically, which in a way makes it more reusable too, but a bit of a pain if the branch name is complex or hard to remember. But at least, you still only have to type it once!&lt;/p&gt;

&lt;p&gt;🤷‍♂️&lt;strong&gt;&lt;em&gt;So how do we use it?&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;develop&lt;span class="o"&gt;}&lt;/span&gt; g &lt;span class="k"&gt;done &lt;/span&gt;feature-branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🤯 Boom. That's it. &lt;/p&gt;

&lt;p&gt;But with this one, we haven't pushed the changes to develop remote. That's where &lt;code&gt;donep&lt;/code&gt; comes in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;donep = "!f() { git merge $1 &amp;amp;&amp;amp; git branch -d $1 &amp;amp;&amp;amp; git push origin :$1 &amp;amp;&amp;amp; git push; }; f"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;develop&lt;span class="o"&gt;}&lt;/span&gt; g donep feature-branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;note:&lt;/em&gt;&lt;/strong&gt; this function also assumes you have done &lt;code&gt;git push origin head -u&lt;/code&gt; and set the upstream. if you haven't and don't want to, you can modify the function to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;donep = "!f() { git merge $1 &amp;amp;&amp;amp; git branch -d $1 &amp;amp;&amp;amp; git push origin :$1 &amp;amp;&amp;amp; git push origin $2; }; f"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and run it like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;develop&lt;span class="o"&gt;}&lt;/span&gt; g donep feature-branch develop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🐱‍👤 &lt;strong&gt;&lt;em&gt;Git r' done!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you find this valuable, please leave a comment and follow me on &lt;a href="https://dev.to/chiangs"&gt;Dev.to @chiangs&lt;/a&gt; and &lt;a href="https://twitter.com/chiangse"&gt;Twitter @chiangse&lt;/a&gt;, 🍻 cheers!&lt;/p&gt;

</description>
      <category>git</category>
      <category>productivity</category>
      <category>showdev</category>
    </item>
    <item>
      <title>🌐 How I host my projects on subdomains</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Sat, 10 Aug 2019 18:16:46 +0000</pubDate>
      <link>https://forem.com/chiangs/host-your-projects-on-subdomains-59m3</link>
      <guid>https://forem.com/chiangs/host-your-projects-on-subdomains-59m3</guid>
      <description>&lt;p&gt;I like hosting my projects on subdomains and keep my main site focused on being the portal to my portfolio. Here's how I do it using &lt;a href="https://netlify.com"&gt;Netlify&lt;/a&gt; and &lt;a href="https://porkbun.com"&gt;Porkbun&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a &lt;a href="https://en.wikipedia.org/wiki/Subdomain"&gt;subdomain&lt;/a&gt;?
&lt;/h2&gt;

&lt;p&gt;A subdomain is a domain that is part of a larger domain; the only domain that is not also a subdomain is the root domain.&lt;/p&gt;

&lt;p&gt;📐Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root domain: www.mainSite.com

subdomain: someUrl.mainSite.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why host projects on subdomains?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Doesn't bloat the main site's repo.&lt;/li&gt;
&lt;li&gt;It's more flexible so that my projects can be different technology stacks.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The steps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Main site
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Setup
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Create a personal site.&lt;/li&gt;
&lt;li&gt;Create a repo on GitHub for it.&lt;/li&gt;
&lt;li&gt;Push it to the repo.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Deployment
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;On Netlify, I select the repo and master branch for my main site.&lt;/li&gt;
&lt;li&gt;After it is successfully built and deployed, I have a someWeirdString.netlify.com that points to my deployed project. &lt;/li&gt;
&lt;li&gt;I'll rename it to something more easy such as &lt;code&gt;myPortfolio.netlify.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;I setup the custom URL if I don't already have one at Porkbun.&lt;/li&gt;
&lt;li&gt;Specify my custom URL such as &lt;a href="http://www.myPortfolio.com"&gt;www.myPortfolio.com&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  DNS Settings
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Login to Porkbun and select my custom URL details.&lt;/li&gt;
&lt;li&gt;In the records, I update the ALIAS record that answers to my Netlify subdomain, which is &lt;code&gt;myPortfolio.netlify.com&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It should look something like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;TYPE&lt;/th&gt;
&lt;th&gt;HOST&lt;/th&gt;
&lt;th&gt;ANSWER&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ALIAS&lt;/td&gt;
&lt;td&gt;myPortfolio.com&lt;/td&gt;
&lt;td&gt;www CNAME myPorfolio.netlify.com&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;After it propagates I move on to the next step and provision a SSL certificate.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Add a subdomain
&lt;/h3&gt;

&lt;p&gt;Once my main site is up and running with &lt;a href="http://www.myPortfolio.com"&gt;www.myPortfolio.com&lt;/a&gt; working, I'll setup another project from another repo to be found at &lt;code&gt;project.myPortfolio.com&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Just like in the first previous steps, I add the project to Netlify and have it build and deploy.&lt;/li&gt;
&lt;li&gt;I'll update the Netlify subdomain to &lt;code&gt;project.netlify.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then I go back to Porkbun and add another CNAME record to &lt;code&gt;www.myPortfolio.com&lt;/code&gt;, it will look like this:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;TYPE&lt;/th&gt;
&lt;th&gt;HOST&lt;/th&gt;
&lt;th&gt;ANSWER&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ALIAS&lt;/td&gt;
&lt;td&gt;myPortfolio.com&lt;/td&gt;
&lt;td&gt;www CNAME myPorfolio.netlify.com&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CNAME&lt;/td&gt;
&lt;td&gt;project.myPortfolio.com&lt;/td&gt;
&lt;td&gt;project.netlify.com&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That's it! Now whenever I navigate to project.myPortfolio.com I'll go to my project which is auto deployed every time that project master branch is updated.&lt;/p&gt;

&lt;p&gt;❗ Don't forget to add an escape hatch like a navigation icon that takes the user back to the main site and/or go another project...that's just good UX.&lt;/p&gt;

&lt;p&gt;If you find this valuable, please leave a comment and follow me on &lt;a href="https://dev.to/chiangs"&gt;Dev.to @chiangs&lt;/a&gt; and &lt;a href="https://twitter.com/chiangse"&gt;Twitter @chiangse&lt;/a&gt;, 🍻 cheers!&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>webdev</category>
      <category>netlify</category>
      <category>porkbun</category>
    </item>
    <item>
      <title>Quick VS Code refactor/productivity trick</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Thu, 08 Aug 2019 13:23:44 +0000</pubDate>
      <link>https://forem.com/chiangs/quick-vs-code-refactor-productivity-trick-103k</link>
      <guid>https://forem.com/chiangs/quick-vs-code-refactor-productivity-trick-103k</guid>
      <description>&lt;p&gt;So I was browsing &lt;strong&gt;&lt;em&gt;Dev.to&lt;/em&gt;&lt;/strong&gt; , like I normally do while waiting for my build process to finish (🐱‍👤) and I saw this post: &lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/hexrcs" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F62575%2F564be6df-fa64-4066-ab96-1e2ba1374f29.png" alt="hexrcs"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/hexrcs/5-visual-studio-code-tricks-to-boost-your-productivity-27a4" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;5 Visual Studio Code Tricks to Boost Your Productivity&lt;/h2&gt;
      &lt;h3&gt;hexrcs ・ Aug 8 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#vscode&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tools&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;And I thought I would share my one of my favorites.&lt;/p&gt;

&lt;p&gt;Often when I need to create an object and as a test or have common values except for a single character I use this flow. It also works in refactoring just pieces of code really fast.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F6yh7h8nrs9ek9unt5msa.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F6yh7h8nrs9ek9unt5msa.gif" alt="demo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's an example, let's say i have an array of objects where I want the values to be 'test1', 'test2', 'test3' respectively to each object in the array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const test = 'test';

const objectArray = [
      {
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
      },
      {
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
      },
      {
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
      },
      ];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case you could just use a multi-cursor and type in the numerical value at the end, but here's another way that that helps out when it's not so easy.&lt;/p&gt;

&lt;p&gt;You could use the &lt;code&gt;ctr + h&lt;/code&gt; to replace &lt;code&gt;test&lt;/code&gt; with &lt;code&gt;test1&lt;/code&gt;, but that could replace more than what you had intended, like the string variable called &lt;code&gt;test&lt;/code&gt; above &lt;code&gt;objArray&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So here's what I do:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select the block of code using some combination of &lt;code&gt;shift&lt;/code&gt;, &lt;code&gt;ctrl&lt;/code&gt; and &lt;code&gt;arrow keys&lt;/code&gt; that is most appropriate.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alt + l&lt;/code&gt; (this notifies vs code that you intend to only do this operation on the selected block.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ctrl + h&lt;/code&gt; (opens the find/replace dialog box)&lt;/li&gt;
&lt;li&gt;type in the value to be replaced&lt;/li&gt;
&lt;li&gt;tab over to type in the value to be replaced&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ctrl + enter&lt;/code&gt;. *update: new version of VS Code defaults to &lt;code&gt;ctrl + alt + enter&lt;/code&gt; but can be changed back in they keyboard shortcuts&lt;/li&gt;
&lt;li&gt;repeat for the next block&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;🔥For me, this is quite fast once the pattern becomes natural.&lt;/p&gt;

&lt;p&gt;Voila❗ now it should look like the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const test = 'test';

const objectArray = [
      {
        prop1: 'test1`,
        prop1: 'test1`,
        prop1: 'test1`,
        prop1: 'test1`,
      },
      {
        prop1: 'test2`,
        prop1: 'test2`,
        prop1: 'test2,
        prop1: 'test2,
      },
      {
        prop1: 'test3`,
        prop1: 'test3`,
        prop1: 'test3`,
        prop1: 'test3`,
      },
      ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And your fingers never had to leave the keyboard, cheers! 🍻&lt;/p&gt;

&lt;p&gt;If you find this valuable, please leave a comment and follow me on &lt;a href="https://dev.to/chiangs"&gt;Dev.to @chiangs&lt;/a&gt; and &lt;a href="https://twitter.com/chiangse" rel="noopener noreferrer"&gt;Twitter @chiangse&lt;/a&gt;, 🍻 cheers!&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>productivity</category>
    </item>
    <item>
      <title>If you could rename JavaScript to be more self descriptive...</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Tue, 16 Jul 2019 05:57:41 +0000</pubDate>
      <link>https://forem.com/chiangs/if-you-could-rename-javascript-to-be-more-self-descriptive-2jo9</link>
      <guid>https://forem.com/chiangs/if-you-could-rename-javascript-to-be-more-self-descriptive-2jo9</guid>
      <description>&lt;p&gt;What would you call it?&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Custom react hooks vs services</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Wed, 10 Jul 2019 19:47:06 +0000</pubDate>
      <link>https://forem.com/chiangs/custom-react-hooks-vs-services-mcm</link>
      <guid>https://forem.com/chiangs/custom-react-hooks-vs-services-mcm</guid>
      <description>&lt;p&gt;I'm having a tough time explaining the difference between a custom react hook and a service. &lt;/p&gt;

&lt;p&gt;It's easy to see the utility of the built in ones, but what about custom hooks?&lt;/p&gt;

&lt;p&gt;with a regular service, I can :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;import it to any component, provide it's functions and or state.&lt;/li&gt;
&lt;li&gt;call or make use of react hooks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;When would you write a custom hook and when would you opt for a service?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;What can you do with a custom hook that you can't do with a service?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Do you consider yourself a polyglot?</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Mon, 03 Jun 2019 06:10:38 +0000</pubDate>
      <link>https://forem.com/chiangs/do-you-consider-yourself-a-polyglot-17m3</link>
      <guid>https://forem.com/chiangs/do-you-consider-yourself-a-polyglot-17m3</guid>
      <description>&lt;p&gt;As developer who only speaks your homeland's language, would you still consider yourself a &lt;a href="https://dictionary.cambridge.org/dictionary/english/polyglot"&gt;polyglot&lt;/a&gt;?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>career</category>
    </item>
    <item>
      <title>🔥 In case of fire: GTFO</title>
      <dc:creator>Stephen Chiang</dc:creator>
      <pubDate>Sat, 20 Apr 2019 20:58:45 +0000</pubDate>
      <link>https://forem.com/chiangs/in-case-of-fire-gtfo-30g4</link>
      <guid>https://forem.com/chiangs/in-case-of-fire-gtfo-30g4</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Hopefully&lt;/em&gt;&lt;/strong&gt; this will never happen to you, but even if it's not a fire or earthquake, an emergency may arise and you are pressed to get out of the office/building and you have uncommitted code.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What do you need to do❓&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;GTFO❗&lt;/em&gt;&lt;/strong&gt;    &lt;em&gt;&lt;a href="https://www.urbandictionary.com/define.php?term=GTFO"&gt;Urban Dictionary Definition&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Typically something along the lines of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; emergency-exit
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git add &lt;span class="nt"&gt;-A&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Emergency exit"&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git push origin &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's a lot of commands to write with a lot of potential for misspellings and having to retype them. I wrote this for fun and thought I would share it. There's two ways I did this: a git alias, Powershell alias on top of the git alias.&lt;/p&gt;

&lt;h3&gt;
  
  
  Aliases
&lt;/h3&gt;

&lt;p&gt;So I first create the git alias by editing the &lt;code&gt;.gitconfig&lt;/code&gt;. I want to create an alias called &lt;code&gt;tfo&lt;/code&gt; and create a function that calls all the git commands I listed above in succession.&lt;/p&gt;

&lt;p&gt;So here's what that looks like (normally 1 line, but wrapped for formatting):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[alias]
    tfo = "!f() { git checkout -b emergency-exit &amp;amp;&amp;amp; git add -A &amp;amp;&amp;amp; git commit -m
       'Emergency exit'  &amp;amp;&amp;amp; git push origin head -u; }; f"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To call this in the terminal command line I would just type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git tfo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✨ That's it! My repo now has a branch called &lt;code&gt;emergency-exit&lt;/code&gt; and I can merge or whatever I need to do later when it's safe.&lt;/p&gt;

&lt;p&gt;If I don't want to write &lt;code&gt;git&lt;/code&gt;: &lt;strong&gt;&lt;em&gt;This step is written for Powershell&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Edit the &lt;code&gt;.profile&lt;/code&gt; to alias &lt;code&gt;g&lt;/code&gt; as &lt;code&gt;git&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; New-Item &lt;span class="nb"&gt;alias&lt;/span&gt;:g &lt;span class="nt"&gt;-value&lt;/span&gt; git

// or directly &lt;span class="k"&gt;in &lt;/span&gt;the profile.ps1 file

New-Alias g git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To call the whole thing then, I would enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; g tfo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💥 Now, I could write a global function called &lt;code&gt;gtfo&lt;/code&gt; that does everything, or even a script, but this was fast and easy and a nice little 10 minute break.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;**Important&lt;/em&gt;*": If you are unlucky to have to do this more than once or you did this to test it out, make sure you delete the new branch after you're done with it or you'll get an error because the branch already exists. You could probably get it to generate the branch with an incrementing number or the current date to differentiate as well.&lt;/p&gt;

&lt;p&gt;Also if you have to do this often... Stay the F away from me...jk... But seriously... Don't come near me.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Update&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Another way to make sure you don't run into a problem if the branch already exists locally is to use &lt;code&gt;-B&lt;/code&gt; instead of &lt;code&gt;-b&lt;/code&gt;. This creates the branch if doesn't exist and if it does, then resets it with the new changes.&lt;/p&gt;

&lt;p&gt;If you find this valuable, please leave a comment and follow me on &lt;a href="https://dev.to/chiangs"&gt;Dev.to @chiangs&lt;/a&gt; and &lt;a href="https://twitter.com/chiangse"&gt;Twitter @chiangse&lt;/a&gt;, 🍻 cheers!&lt;/p&gt;

</description>
      <category>git</category>
      <category>productivity</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
