<?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: David Coy</title>
    <description>The latest articles on DEV Community by David Coy (@davidcoy).</description>
    <link>https://dev.to/davidcoy</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%2F8734%2Ff69e4dc0-a2c5-42b6-aa0a-a846cf109424.jpg</url>
      <title>DEV Community: David Coy</title>
      <link>https://dev.to/davidcoy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/davidcoy"/>
    <language>en</language>
    <item>
      <title>Rename local and remote branch</title>
      <dc:creator>David Coy</dc:creator>
      <pubDate>Tue, 26 Feb 2019 19:51:15 +0000</pubDate>
      <link>https://dev.to/davidcoy/rename-local-and-remote-branch-52e0</link>
      <guid>https://dev.to/davidcoy/rename-local-and-remote-branch-52e0</guid>
      <description>&lt;p&gt;We've all been there (or maybe you haven't, hopefully this helps prevent what's to follow): cloning the project, making changes in our local branch, then commiting those changes to the repository, only to find you didn't follow the contribution guidelines for branch naming. Recently, I opened a merge request against the &lt;a href="https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25498"&gt;docs for GitLab&lt;/a&gt;, but didn't follow our documentation guidelines for &lt;a href="https://docs.gitlab.com/ee/development/documentation/index.html#branch-naming"&gt;branch naming&lt;/a&gt; as I should have.&lt;/p&gt;

&lt;p&gt;Initially, I created my branch: &lt;code&gt;add-efs-warning&lt;/code&gt;, committed my changes and opened up the merge request. However, this was wrong as the branch name &lt;em&gt;also&lt;/em&gt; needs to be prefixed with &lt;code&gt;docs/&lt;/code&gt;, &lt;code&gt;docs-&lt;/code&gt;, or &lt;code&gt;-docs&lt;/code&gt;. Rather than copying the changes I made to a blank text file, changing to the master branch, deleting the old branch, then creating a new branch and applying the changes, I learned how to rename my local branch &lt;em&gt;and&lt;/em&gt; remote branch.&lt;/p&gt;

&lt;p&gt;Let's say you did the exact same thing I did and you're on your wrongly named local branch -- let's call it &lt;code&gt;bad-branch-name&lt;/code&gt;. If you want to rename the branch, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-m&lt;/span&gt; docs/new-branch-name
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will rename the current local branch to &lt;code&gt;docs/new-branch-name&lt;/code&gt; and avoid feedback from the technical writers that review your changes. Next, you can run the following command to rename &lt;code&gt;bad-branch-name&lt;/code&gt; to &lt;code&gt;docs/new-branch-name&lt;/code&gt; and push the new local branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;git push origin :bad-branch-name docs/new-branch-name
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Finally, you can reset the upstream branch for the new local branch (switch to the branch if you're not currently working in it):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;git push origin &lt;span class="nt"&gt;-u&lt;/span&gt; docs/new-branch-name
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Cover image by &lt;a href="https://unsplash.com/photos/H-_Qtte5YU8?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Teddy Kelley&lt;/a&gt; on &lt;a href="https://unsplash.com/?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>beginners</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Hi, I'm David Coy</title>
      <dc:creator>David Coy</dc:creator>
      <pubDate>Wed, 12 Apr 2017 01:37:38 +0000</pubDate>
      <link>https://dev.to/davidcoy/hi-im-david-coy</link>
      <guid>https://dev.to/davidcoy/hi-im-david-coy</guid>
      <description>&lt;p&gt;I have been coding for about two years.&lt;/p&gt;

&lt;p&gt;You can find me on GitHub as &lt;a href="https://github.com/obsidianspork" rel="noopener noreferrer"&gt;obsidianspork&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I live in Texas.&lt;/p&gt;

&lt;p&gt;I work for the &lt;a href="https://linuxacademy.com" rel="noopener noreferrer"&gt;Linux Academy&lt;/a&gt; as a Customer Support Engineer!&lt;/p&gt;

&lt;p&gt;I mostly program in these languages: Ruby and JavaScript whenever I have time.&lt;/p&gt;

&lt;p&gt;I am currently learning more about Ruby on Rails.&lt;/p&gt;

&lt;p&gt;Nice to meet you!&lt;/p&gt;

</description>
      <category>introduction</category>
    </item>
  </channel>
</rss>
