<?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: Clendon DuRapau</title>
    <description>The latest articles on DEV Community by Clendon DuRapau (@clendon).</description>
    <link>https://dev.to/clendon</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%2F649155%2Ff25f4dde-09bd-48ba-beb3-05772d5ce0ab.jpeg</url>
      <title>DEV Community: Clendon DuRapau</title>
      <link>https://dev.to/clendon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/clendon"/>
    <language>en</language>
    <item>
      <title>Add a Local Git Repository to GitHub</title>
      <dc:creator>Clendon DuRapau</dc:creator>
      <pubDate>Tue, 01 Mar 2022 03:31:56 +0000</pubDate>
      <link>https://dev.to/clendon/add-a-local-git-repository-to-github-2cp1</link>
      <guid>https://dev.to/clendon/add-a-local-git-repository-to-github-2cp1</guid>
      <description>&lt;p&gt;You’ve created a project on your local machine, you’ve initialized it as a git repository, and you’re coding along happily.&lt;/p&gt;

&lt;p&gt;Now you’ve decided that you’d like to save a copy on &lt;a href="http://github.com"&gt;GitHub&lt;/a&gt;. Maybe so that you can collaborate with others more easily? Maybe just so that you can save it remotely? Whatever the reason, how do you do it?&lt;/p&gt;

&lt;p&gt;It’s easy!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a blank &lt;a href="http://github.com"&gt;GitHub&lt;/a&gt; repository like you normally would by clicking one of the “New” buttons you can find in various places on the website after you’ve signed in.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vhT1ZePo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ix9mbnpp2pitnrzurvlm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vhT1ZePo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ix9mbnpp2pitnrzurvlm.png" alt="screenshot of new repo button" width="274" height="228"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Give your repository a name that makes sense for your project, write a description if you want, and to avoid merge conflicts, leave “Add a README file” and “Add .gitignore” &lt;em&gt;unchecked&lt;/em&gt; for now. It’s probably better to just create those on your own at this point if they don’t already exist for your project. Then click on “Create repository” at the bottom of the form.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ip9NLuwJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6sgv0v4mjxogp5m1pucd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ip9NLuwJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6sgv0v4mjxogp5m1pucd.png" alt="screenshot of create new repo form" width="766" height="741"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The best part! &lt;a href="http://github.com"&gt;GitHub&lt;/a&gt; already has instructions here for you on &lt;em&gt;exactly&lt;/em&gt; what to do next on your terminal command line! In fact, although we didn’t cover it here, there are even instructions on what to do if you don’t even have a repository at all and how to create one right now if you had not already done so.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VmGjgBzH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f0c29g57h27dwy1v70t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VmGjgBzH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f0c29g57h27dwy1v70t.png" alt="screenshot of repo quick setup page" width="880" height="634"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So let’s go ahead and use the URL that is provided by GitHub (as you can see in the screenshot) for your new online repository and run those three lines in the terminal from the root directory of your local repository. They’ve made it so easy that you don’t even have to plug in the URL; you can simply copy and paste it. So in my case, it would look like this with the URL for the repo I’ve just made:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add origin https://github.com/clendon/practice-repo.git
git branch &lt;span class="nt"&gt;-M&lt;/span&gt; master
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If during step 3, you get the error &lt;code&gt;fatal: remote origin already exists.&lt;/code&gt;, it’s because your local repository is already associated with a different online repository, but we can remove that association and fix it easily. Do the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote remove origin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then attempt step 3 again and that should do the trick.&lt;/p&gt;

&lt;p&gt;And there you go, should now be able to &lt;code&gt;push&lt;/code&gt; and &lt;code&gt;pull&lt;/code&gt; from/to your remote repository on &lt;a href="http://github.com"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>github</category>
      <category>gitcli</category>
      <category>git</category>
    </item>
    <item>
      <title>Stop Tracking Files in .gitignore</title>
      <dc:creator>Clendon DuRapau</dc:creator>
      <pubDate>Mon, 28 Feb 2022 07:24:15 +0000</pubDate>
      <link>https://dev.to/clendon/stop-tracking-files-in-gitignore-857</link>
      <guid>https://dev.to/clendon/stop-tracking-files-in-gitignore-857</guid>
      <description>&lt;p&gt;Git workflow can get out of sync between team members, causing some very frustrating merge conflicts. In the excitement of getting a new project rolling and setting up the repository, it’s easy to start making commits without realizing that you’ve forgotten to add that pesky &lt;code&gt;package-lock.json&lt;/code&gt; to &lt;code&gt;.gitignore&lt;/code&gt; or even the target path where all your transpiled files end up.&lt;/p&gt;

&lt;p&gt;This can cause things to get ugly fast when working with a team.&lt;/p&gt;

&lt;p&gt;Here’s the fastest and easiest solution I have found.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;edit your &lt;code&gt;.gitignore&lt;/code&gt; file and add the files you do not want tracked.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;run the following in the root directory of your project&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git ls-files &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="nt"&gt;--ignored&lt;/span&gt; &lt;span class="nt"&gt;--exclude-standard&lt;/span&gt; &lt;span class="nt"&gt;-z&lt;/span&gt; | xargs &lt;span class="nt"&gt;-0&lt;/span&gt; git &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;--cached&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make a new commit&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Stopped tracking and deleted files in .gitignore"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Caution&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The ignored files will not automatically be deleted from your local repository after taking these steps. You will have to do that manually if you want to get rid of them.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you &lt;code&gt;push&lt;/code&gt; your changes to a remote repository, when other team members &lt;code&gt;pull&lt;/code&gt; the changes to their local repositories, git will delete the ignored files from their machines. This means that those team members will have to rebuild those transpiled files with the compiler used in the project or the &lt;code&gt;package-lock.json&lt;/code&gt; with either&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm ci
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>gitignore</category>
      <category>gitcli</category>
    </item>
  </channel>
</rss>
