<?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: stefaleon</title>
    <description>The latest articles on DEV Community by stefaleon (@stefaleon).</description>
    <link>https://dev.to/stefaleon</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%2F343391%2F3a0ebbd9-904a-4efa-adc0-2d77ca6258dd.jpeg</url>
      <title>DEV Community: stefaleon</title>
      <link>https://dev.to/stefaleon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stefaleon"/>
    <language>en</language>
    <item>
      <title>Share Code With A Github Repository - A Quick Start Guide</title>
      <dc:creator>stefaleon</dc:creator>
      <pubDate>Thu, 07 May 2020 09:50:15 +0000</pubDate>
      <link>https://dev.to/stefaleon/quick-start-guide-for-sharing-code-with-a-github-repository-e7l</link>
      <guid>https://dev.to/stefaleon/quick-start-guide-for-sharing-code-with-a-github-repository-e7l</guid>
      <description>&lt;p&gt; &lt;br&gt;
&lt;strong&gt;Problem:&lt;/strong&gt; You have code you want to share with others and you don’t know git…&lt;br&gt;
 &lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; Here are the basic steps to follow&lt;br&gt;
 &lt;br&gt;
1 Download and install Git&lt;br&gt;&lt;br&gt;
&lt;a href="https://git-scm.com/" rel="noopener noreferrer"&gt;Git Page&lt;/a&gt;    &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=d3g_e0HFMzI" rel="noopener noreferrer"&gt;Install Git on Win10 quick video&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;2 Navigate to the root folder of your project and create a file named &lt;em&gt;.gitignore&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Include inside it the folders and files that you do NOT want to share.&lt;/p&gt;

&lt;p&gt;e.g.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules
client/node_modules
config/default.json
private/my_secret_passwords.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3 Initiate a git repository by typing&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in the console&lt;/p&gt;

&lt;p&gt;4 Stage all the files you are about to commit by typing&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5 Make the commit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m 'YOUR_DESCRIPTIVE_MESSAGE'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;YOUR_DESCRIPTIVE_MESSAGE is just informative text&lt;/em&gt;&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
So far you have commited your code to a local git repository.&lt;br&gt;
 &lt;br&gt;
Now you need to make it public, with a remote repository hosted in Github.&lt;br&gt;
(There are alternatives to Github, such as Gitlab, Bitbucket and more but this is not the topic of this article…)&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;6 Sign up and sign in to Github: &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;https://github.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7 From the top-right select the + sign , New Repository&lt;/p&gt;

&lt;p&gt;8 Set a name for the new repository, e.g myrepo&lt;/p&gt;

&lt;p&gt;9 In the next screen, copy the lines from the paragraph &lt;em&gt;…or push an existing repository from the command line&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%2Fi.imgur.com%2FGCbmotc.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%2Fi.imgur.com%2FGCbmotc.png" alt="image"&gt;&lt;/a&gt;&lt;br&gt;
e.g.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote add origin https://github.com/stefaleon/myrepo.git
git branch -M main
git push -u origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;10 Paste those lines in the console and enter&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Now the contents of your project (except the .gitignore includes) are uploaded to a repository in Github which you can &lt;strong&gt;share&lt;/strong&gt; via the url like&lt;br&gt;
&lt;strong&gt;&lt;a href="https://github.com/your_github_name/myrepo" rel="noopener noreferrer"&gt;https://github.com/your_github_name/myrepo&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&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%2Fmiro.medium.com%2Fmax%2F1400%2F0%2Af1vWEOzBr0sdF7Ip.jpg" 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%2Fmiro.medium.com%2Fmax%2F1400%2F0%2Af1vWEOzBr0sdF7Ip.jpg" alt="thats all folks!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;

&lt;p&gt;After on, if you update your code you can be updating your local commits with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
git commit -m 'YOUR_NEW_COMMIT_MESSAGE"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and also updating the remote copy of your repository in Github with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>git</category>
      <category>github</category>
      <category>npm</category>
    </item>
  </channel>
</rss>
