<?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>DEV Community: Bianca Power</title>
    <description>The latest articles on DEV Community by Bianca Power (@biancapower).</description>
    <link>https://dev.to/biancapower</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%2F81612%2F22326463-2a0f-4c47-86dc-bb6e39b7b08e.jpg</url>
      <title>DEV Community: Bianca Power</title>
      <link>https://dev.to/biancapower</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/biancapower"/>
    <language>en</language>
    <item>
      <title>How to Combine Git Commits - Squash 'em with a rebase!</title>
      <dc:creator>Bianca Power</dc:creator>
      <pubDate>Mon, 13 Apr 2020 22:26:01 +0000</pubDate>
      <link>https://dev.to/biancapower/how-to-combine-git-commits-squash-em-with-a-rebase-380g</link>
      <guid>https://dev.to/biancapower/how-to-combine-git-commits-squash-em-with-a-rebase-380g</guid>
      <description>&lt;p&gt;Here's the situation. Everything seems to be working well with your current code, so you do a &lt;code&gt;git commit&lt;/code&gt;. Then you notice a small bug, or maybe you forgot to comment an important line of code, or to remove all of your &lt;code&gt;console.log&lt;/code&gt;s. So you make your minor changes... and &lt;code&gt;git commit&lt;/code&gt; again. Then you push to production - and let's face it, nothing 'just works' when you push to production - and now you need to make a few more minor changes, you add them, &lt;code&gt;git commit&lt;/code&gt; again. Maybe this happens a few times, before you're &lt;em&gt;actually&lt;/em&gt; done with that bit of code. So now when you look at the commit history, there's the original, nicely named commit, maybe something like "implement new navbar", then there are a litter of commits following it, things like "bugfix", "please work now", "working navbar", "navbar fix AGAIN". Or maybe your commit messages are better than that, but either way, ideally, all of that code should have been part of the "implement new navbar" commit. Read on for how to do just that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here's how we can combine multiple commits into one, to neaten up our git history and make it easier to see what went on.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Below is an &lt;a href="https://asciinema.org/" rel="noopener noreferrer"&gt;asciinema&lt;/a&gt; cast of me doing just that.&lt;/p&gt;


&lt;div class="ltag_asciinema"&gt;
  
&lt;/div&gt;


&lt;p&gt;Let's talk it through. First, doing &lt;code&gt;git log&lt;/code&gt; shows us the most recent commits. In this case, it's the most recent 4 commits that we want to combine. Those are shown here:&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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot1.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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot1.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, quit out of git log, so we're back to the terminal.&lt;/p&gt;

&lt;p&gt;Quick side note: After running the command in the next step, git launches us into our default text editor so that we can make some changes and specify what we want. Most systems will default to something like vi or vim, but if you're not comfortable in those environments, go and check out my article on how to change your default text editor &lt;strong&gt;before&lt;/strong&gt; doing the next step.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/biancapower" 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%2F81612%2F22326463-2a0f-4c47-86dc-bb6e39b7b08e.jpg" alt="biancapower"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/biancapower/how-to-change-your-default-text-editor-for-git-and-avoid-vim-fk0" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;How to change your default text editor for git (and avoid vim)&lt;/h2&gt;
      &lt;h3&gt;Bianca Power ・ Apr 11 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#git&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;Now the part we've been waiting for! We're going to run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ git rebase -i HEAD~4&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is a &lt;code&gt;git&lt;/code&gt; command named &lt;code&gt;rebase&lt;/code&gt;, which we're going to do in interactive mode (&lt;code&gt;-i&lt;/code&gt; for short), and we're doing it on the most recent 4 commits, which we specify with &lt;code&gt;HEAD~4&lt;/code&gt; (HEAD is how we refer to our most recent commit). When we run that command we see:&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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot2.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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot2.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the top we have a list of the most recent 4 commits - the ones we want to combine. Below that, git helpfully tells us about the options we have. The option we want to use is &lt;code&gt;squash&lt;/code&gt;, which will 'use commit, but meld into previous commit'. To do that, we edit the file we're in, changing 'pick' to 'squash' for just the commits we want to squash - we leave the original commit unchanged, because that's the one we want to squash the others into (in vim, hit &lt;code&gt;i&lt;/code&gt; to enter insert mode). At this point we see:&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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot3.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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot3.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we save and close the file (&lt;code&gt;:wq&lt;/code&gt; in vim). As soon as we've done that, we get launched into another file:&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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot4.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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot4.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, git wants us to specify the commit message for the combined commit. In this case, we just want the original commit message, so we need to remove (or comment out) any other text, leaving us with:&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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot5.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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot5.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we save and close that file, and we're back in terminal. Doing &lt;code&gt;git log&lt;/code&gt; shows us that our commit history has changed:&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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot6.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%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fhow-to-combine-git-commits%2Fassets%2FScreenShot6.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We see our combined commit, as well as some older commits that weren't changed.&lt;/p&gt;

&lt;p&gt;Did you find this helpful? I'd love to hear your feedback!&lt;/p&gt;

&lt;h1&gt;
  
  
  Found a typo?
&lt;/h1&gt;

&lt;p&gt;If you've found a typo, a sentence that could be improved or anything else that should be updated on this blog post, you can access it through a git repository and make a pull request. Instead of posting a comment, please go directly to &lt;a href="https://github.com/biancapower/my-dev.to"&gt;https://github.com/biancapower/my-dev.to&lt;/a&gt; and open a new pull request with your changes.&lt;/p&gt;

</description>
      <category>git</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Writing a Bash function to automate Exercism.io exercise setup</title>
      <dc:creator>Bianca Power</dc:creator>
      <pubDate>Mon, 13 Apr 2020 06:34:20 +0000</pubDate>
      <link>https://dev.to/biancapower/writing-a-bash-function-to-automate-exercism-io-exercise-setup-2mlo</link>
      <guid>https://dev.to/biancapower/writing-a-bash-function-to-automate-exercism-io-exercise-setup-2mlo</guid>
      <description>&lt;p&gt;Lately I've been working my way through the JavaScript track on &lt;a href="https://exercism.io/" rel="noopener noreferrer"&gt;Exercism.io&lt;/a&gt;. It's an excellent website and I highly recommend checking it out if you either want to work on your skills in a particular language (there are 50 to choose from), or are comfortable in a particular programming language and interested in mentoring others.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/biancapower/my-dev.to/master/blog-posts/a-bash-function-for-exercism.io/tps://exercism.io/"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbiancapower%2Fmy-dev.to%2Fmaster%2Fblog-posts%2Fa-bash-function-for-exercism.io%2Fassets%2Fexercism-site.png" alt="Exercism.io"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Something I found a little repetitive was the process of setting things up to work on an exercise. The process went something like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;open the exercise in the browser&lt;/li&gt;
&lt;li&gt;copy the download command (e.g. &lt;code&gt;exercism download --exercise=collatz-conjecture --track=javascript&lt;/code&gt;) from the browser window, and paste it into terminal&lt;/li&gt;
&lt;li&gt;cd into the correct folder (e.g. &lt;code&gt;cd Exercism/javascript/collatz-conjecture&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;run &lt;code&gt;npm install&lt;/code&gt; so that the tests are ready to be run&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Pretty straightforward, but also a predictable and repeatable pattern... perfect for a bash function! Here's the command I want to be able to run in order to make all of the above execute (where the name of the exercise is 'collatz-conjecture'):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ devil collatz-conjecture&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To make this possible, here's the bash function that I added to my &lt;code&gt;.zshrc&lt;/code&gt; (I use zsh so added it to my &lt;code&gt;.zshrc&lt;/code&gt;, but if you're using bash, add it to your &lt;code&gt;.bashrc&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;devil() {
    exercism download --exercise=$1 --track=javascript &amp;amp;&amp;amp; cd ~/Exercism/javascript/$1 &amp;amp;&amp;amp; npm install;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Let's break it down. On line 1 is the name I've given to the function (devil), followed by parentheses and an open curly brace (standard function syntax). I named my function 'devil' because it's easy to type, and something I associate easily with 'exercism' (making it easy to remember).&lt;/p&gt;

&lt;p&gt;Line 2 is where the awesomeness happens. These are all the steps I was previously doing 'manually', run for me by executing only one command. The &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; between each command means that each command must succeed in order for the next one to execute. This makes sense in this context, because each command relies on the previous commands's success. For example, we can't cd into the folder in step 2 if it wasn't created in step 1. But what about the &lt;code&gt;$1&lt;/code&gt;? That's the bash way of saying "grab the first argument passed in when the function is run, and use it here". So in our example above, &lt;code&gt;$1&lt;/code&gt; would hold the value &lt;code&gt;collatz-conjecture&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Line 3 is the closing brace to end the function.&lt;/p&gt;

&lt;p&gt;So now all I need to know is the name of the next exercise I want to attempt on &lt;a href="https://exercism.io/" rel="noopener noreferrer"&gt;Exercism.io&lt;/a&gt;, and I can simply run &lt;code&gt;devil exercise-name&lt;/code&gt; to have my bash function do all the setup work for me!&lt;/p&gt;

&lt;p&gt;Here's what it looks like in action:&lt;/p&gt;


&lt;div class="ltag_asciinema"&gt;
  
&lt;/div&gt;



&lt;h1&gt;
  
  
  Found a typo?
&lt;/h1&gt;

&lt;p&gt;If you've found a typo, a sentence that could be improved or anything else that should be updated on this blog post, you can access it through a git repository and make a pull request. Instead of posting a comment, please go directly to &lt;a href="https://github.com/biancapower/my-dev.to"&gt;https://github.com/biancapower/my-dev.to&lt;/a&gt; and open a new pull request with your changes.&lt;/p&gt;

</description>
      <category>bash</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to add ASCII Art around code comment blocks in vim</title>
      <dc:creator>Bianca Power</dc:creator>
      <pubDate>Sun, 12 Apr 2020 06:54:18 +0000</pubDate>
      <link>https://dev.to/biancapower/how-to-add-ascii-art-around-code-comment-blocks-in-vim-1o1m</link>
      <guid>https://dev.to/biancapower/how-to-add-ascii-art-around-code-comment-blocks-in-vim-1o1m</guid>
      <description>&lt;p&gt;While browsing Twitter this morning I came across this awesome gem&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1249081168072282113-467" src="https://platform.twitter.com/embed/Tweet.html?id=1249081168072282113"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1249081168072282113-467');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1249081168072282113&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;and started experimenting! The full article is &lt;a href="https://www.cyberciti.biz/tips/unix-linux-draw-any-kind-of-boxes-around-text-editor.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;, but here's my quick guide on how to get started.&lt;/p&gt;

&lt;h1&gt;
  
  
  Installation
&lt;/h1&gt;

&lt;p&gt;What we're going to use is a text filter program called &lt;a href="https://boxes.thomasjensen.com/about.html" rel="noopener noreferrer"&gt;boxes&lt;/a&gt;. Step 1 is installation.&lt;/p&gt;

&lt;p&gt;Debian-based systems:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ sudo apt-get install boxes&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Mac (OSX):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ brew install boxes&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here's what that process looks like on OSX:&lt;/p&gt;


&lt;div class="ltag_asciinema"&gt;
  
&lt;/div&gt;


&lt;p&gt;We can check that boxes has installed successfully by running &lt;code&gt;boxes -v&lt;/code&gt;. If we get something like &lt;code&gt;boxes version 1.3&lt;/code&gt;, that means boxes is installed (it's ok if your version number is different).&lt;/p&gt;

&lt;h1&gt;
  
  
  Command line use
&lt;/h1&gt;

&lt;p&gt;Now we have boxes. Great! What next? Before we go using it in vim, let's play around with it a bit on the command line. The &lt;a href="https://asciinema.org/" rel="noopener noreferrer"&gt;asciinema video&lt;/a&gt; below captures the main commands and a demo (you can copy the text out of the video - try it!), or scroll down for a list of the commands to try.&lt;/p&gt;


&lt;div class="ltag_asciinema"&gt;
  
&lt;/div&gt;


&lt;p&gt;To use boxes on the command line, we pipe some text into it. For example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ echo "Here's some text I want to put a box around!" | boxes&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To list all available box designs in the config file (my install came with 65!), we run:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ boxes -l | less&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;less&lt;/code&gt; isn't strictly necessary, but it allows us to more easily navigate through the lengthy output.&lt;/p&gt;

&lt;p&gt;To use a particular design, append &lt;code&gt;-d [designname]&lt;/code&gt; to the command. For example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ echo "Here's some text I want to put a box around!" | boxes -d cat&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Use in vim
&lt;/h1&gt;

&lt;p&gt;Now comes the super fun part! We can use vim to add any of these boxes around some lines in a file. Think multi-line code comments we really want to stand out, or making documentation files more interesting!&lt;/p&gt;

&lt;p&gt;Here's how (written steps below video):&lt;/p&gt;


&lt;div class="ltag_asciinema"&gt;
  
&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;write some lines of plain text (we'll wrap comments around them in the next steps)&lt;/li&gt;
&lt;li&gt;place the cursor in the first of the lines to be commented&lt;/li&gt;
&lt;li&gt;specify the number of lines to comment, followed by &lt;code&gt;!!&lt;/code&gt;, then the boxes command you want to use. E.g.: to comment 4 lines, and use the cat design, do the following:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;4!!boxes -d cat&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and you'll have something like...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            /\             /\
           |`\\_,--="=--,_//`|
           \ ."  :'. .':  ". /
          ==)  _ :  '  : _  (==
            |&amp;gt;/O\   _   /O\&amp;lt;|
            | \-"~` _ `~"-/ |
           &amp;gt;|`===. \_/ .===`|&amp;lt;
     .-"-.   \==='  |  '===/   .-"-.
.---{'. '`}---\,  .-'-.  ,/---{.'. '}---.
 )  `"---"`     `~-===-~`     `"---"`  (
(  I'm a cat                            )
 ) I'm a kitty cat                     (
(  And I dance dance dance              )
 ) And I dance dance dance             (
'---------------------------------------'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are several configuration options, including alignment of the text within the box. It's also possible to create your own designs and add them to the config. For all this and more, check out the man page by running&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ man boxes&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Happy commenting!&lt;/p&gt;

&lt;h1&gt;
  
  
  Found a typo?
&lt;/h1&gt;

&lt;p&gt;If you've found a typo, a sentence that could be improved or anything else that should be updated on this blog post, you can access it through a git repository and make a pull request. Instead of posting a comment, please go directly to &lt;a href="https://github.com/biancapower/my-dev.to"&gt;https://github.com/biancapower/my-dev.to&lt;/a&gt; and open a new pull request with your changes.&lt;/p&gt;

</description>
      <category>vim</category>
      <category>bash</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to change your default text editor for git (and avoid vim)</title>
      <dc:creator>Bianca Power</dc:creator>
      <pubDate>Sat, 11 Apr 2020 08:36:24 +0000</pubDate>
      <link>https://dev.to/biancapower/how-to-change-your-default-text-editor-for-git-and-avoid-vim-fk0</link>
      <guid>https://dev.to/biancapower/how-to-change-your-default-text-editor-for-git-and-avoid-vim-fk0</guid>
      <description>&lt;p&gt;We've all done it. &lt;code&gt;git add .&lt;/code&gt; then... &lt;code&gt;git commit&lt;/code&gt;. Big mistake. We forgot to add a &lt;code&gt;-m&lt;/code&gt; with a message! Now we're in the dreaded vim text editor...&lt;/p&gt;


&lt;div class="ltag_asciinema"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;em&gt;But what if there was another way?&lt;/em&gt; By changing the git config, we can specify &lt;strong&gt;a different editor for git to launch us into&lt;/strong&gt; if it needs to do so. Below is how to do this on a unix (OSX or Linux) system.&lt;/p&gt;

&lt;p&gt;First, &lt;strong&gt;check what your current system default is&lt;/strong&gt; (you can pause the video below and copy the text command out of it - try it now!):&lt;/p&gt;


&lt;div class="ltag_asciinema"&gt;
  
&lt;/div&gt;


&lt;p&gt;In the example above, as on many systems, the default editor is vim. Personally, I love vim, but if you're not familiar with it it can make things a bit difficult and really mess up your flow. First let's look at &lt;strong&gt;how to change git's default text editor to nano&lt;/strong&gt;, and what nano looks like in practice:&lt;/p&gt;


&lt;div class="ltag_asciinema"&gt;
  
&lt;/div&gt;


&lt;p&gt;As you can see, nano is much more straight forward than vim (not least because it gives you the commands you need at the bottom of the screen!), but it still exists completely in the terminal (which has pros and cons).&lt;/p&gt;

&lt;p&gt;What if you want to change the editor used by git to something external to the terminal, like &lt;strong&gt;VS Code&lt;/strong&gt;? Here's how:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/R9u2e66IKzc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Note that changing the editor to &lt;code&gt;code&lt;/code&gt; didn't work quite as we wanted it to - because we're leaving the terminal environment in order to go and edit the file in VS Code, we need to tell git to wait for us. We do that by specifying &lt;code&gt;code --wait&lt;/code&gt;, which basically says "Hey git, I'm gonna go over to VS Code to edit that file now, just hang about, and once I've closed that file you can read it and finish processing the command".&lt;/p&gt;

&lt;p&gt;The process for changing the default to other text editor is basically the same, it's just a matter of finding the correct key word(s) for launching the editor.&lt;/p&gt;

&lt;p&gt;What do you use as your default text editor? Comment below!&lt;/p&gt;

&lt;h1&gt;
  
  
  Found a typo?
&lt;/h1&gt;

&lt;p&gt;If you've found a typo, a sentence that could be improved or anything else that should be updated on this blog post, you can access it through a git repository and make a pull request. Instead of posting a comment, please go directly to &lt;a href="https://github.com/biancapower/my-dev.to"&gt;https://github.com/biancapower/my-dev.to&lt;/a&gt; and open a new pull request with your changes.&lt;/p&gt;

</description>
      <category>git</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
