<?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: samkb@420</title>
    <description>The latest articles on DEV Community by samkb@420 (@samkb420).</description>
    <link>https://dev.to/samkb420</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%2F277628%2F8ee409f5-c8bc-488f-ad68-ecce4be8581c.jpeg</url>
      <title>DEV Community: samkb@420</title>
      <link>https://dev.to/samkb420</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samkb420"/>
    <language>en</language>
    <item>
      <title>Intro to Git and GitHub</title>
      <dc:creator>samkb@420</dc:creator>
      <pubDate>Sat, 11 Sep 2021 13:08:40 +0000</pubDate>
      <link>https://dev.to/samkb420/intro-to-git-and-github-5fig</link>
      <guid>https://dev.to/samkb420/intro-to-git-and-github-5fig</guid>
      <description>&lt;p&gt;Git is  Version Control System(VCS) for tracking changes in computer files&lt;br&gt;
It entails the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Distributed Version Control&lt;/li&gt;
&lt;li&gt;Coordinates work between Multiple developers (Collaboration)&lt;/li&gt;
&lt;li&gt;Who made What changes and When&lt;/li&gt;
&lt;li&gt;Revert back at anytime (rollback)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub is a for-profit company that offers a cloud-based Git repository hosting service.&lt;/p&gt;
&lt;h2&gt;
  
  
  Concepts of GitHub
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Keep track of code history&lt;/li&gt;
&lt;li&gt;Take 'snapshots' of your files&lt;/li&gt;
&lt;li&gt;You can visit any snapshot at anytime&lt;/li&gt;
&lt;li&gt;Local &amp;amp; Remote repositories&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lets make our hands Dirty and get Started by installing and performing basic git commands&lt;/p&gt;
&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;Click on the below link it will take you to git download page then choose your OS and continue with the installation process follow the Instruction&lt;br&gt;
&lt;a href="https://git-scm.com/downloads"&gt;https://git-scm.com/downloads&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;Love command-line let's Dive in.😎&lt;/p&gt;

&lt;p&gt;Check Git version&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="nv"&gt;$ &lt;/span&gt;git &lt;span class="nt"&gt;--version&lt;/span&gt;

git version 2.25.1

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

&lt;/div&gt;



&lt;p&gt;Configuring git on Your machine&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="nv"&gt;$ &lt;/span&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.name &lt;span class="s1"&gt;'yourusername'&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email &lt;span class="s1"&gt;'youremail@abc.com'&lt;/span&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;git config &lt;span class="nt"&gt;--list&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Need help?&lt;br&gt;
&lt;code&gt;git help &amp;lt;verb&amp;gt;&lt;/code&gt; or &lt;code&gt;git &amp;lt;verb&amp;gt; --help&lt;/code&gt;&lt;br&gt;
ie. &lt;code&gt;git git help branch&lt;/code&gt; or &lt;code&gt;git branch --help&lt;/code&gt;&lt;br&gt;
Lets create a directory where we shall do git operation and navigate into the directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir Learning_git 
$ cd Learning_git

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

&lt;/div&gt;



&lt;p&gt;that's pretty easy,&lt;/p&gt;

&lt;p&gt;Initializing a Git Repository&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="nv"&gt;$ &lt;/span&gt;git init 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;expected output&lt;br&gt;
&lt;code&gt;Initialized empty Git repository in /home/samkb420/MyHobby/Learning_git/.git/&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Adding file(s) to index&lt;br&gt;
let use the ls command to list file and folders.&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="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output&lt;br&gt;
&lt;code&gt;total 12&lt;br&gt;
drwxrwxr-x  3 samkb420 samkb420 4096 Aug 19 02:14 ./&lt;br&gt;
drwxrwxr-x 52 samkb420 samkb420 4096 Aug 18 19:11 ../&lt;br&gt;
drwxrwxr-x  7 samkb420 samkb420 4096 Aug 19 02:14 .git/&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
lets create a file.&lt;br&gt;
we shall build a simple calculator in python don't worry if you don't know python its not that complex.&lt;br&gt;
let's open our text editor for me am using vscode.&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="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;calc.py
&lt;span class="nv"&gt;$ &lt;/span&gt;code &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;let do simple add method in python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def add(a,b):

    return a + b
print(add(5,5))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;having done that let do 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;$ git add -A  
$ git commit -m "[First commit #0001 ]"
$ git status 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;On branch main
nothing to commit, working tree clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now lets push the code in a remote repo in this case I Will use github.&lt;br&gt;
continue into github and create a repo.&lt;br&gt;
lets add the github remote url &lt;br&gt;
i.e&lt;br&gt;
&lt;code&gt;git remote add origin https://github.com/BitgritCampus/Learn_Git_Github.git&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;$git remote add origin remote_github_url
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;let now push to GitHub&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 -u origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now add you credentials username and PAT(personal access token)&lt;br&gt;
Hurrryy !! Done &lt;/p&gt;

&lt;p&gt;Next on Merging.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>github</category>
      <category>codenewbie</category>
      <category>datascience</category>
    </item>
  </channel>
</rss>
