<?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: VidyaR</title>
    <description>The latest articles on DEV Community by VidyaR (@vidyarautela).</description>
    <link>https://dev.to/vidyarautela</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%2F319626%2Fd474880f-db8d-42d1-8a86-e19d8a50af36.jpg</url>
      <title>DEV Community: VidyaR</title>
      <link>https://dev.to/vidyarautela</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vidyarautela"/>
    <language>en</language>
    <item>
      <title>Git Goodness</title>
      <dc:creator>VidyaR</dc:creator>
      <pubDate>Sat, 01 Aug 2020 11:20:56 +0000</pubDate>
      <link>https://dev.to/vidyarautela/git-goodness-naa</link>
      <guid>https://dev.to/vidyarautela/git-goodness-naa</guid>
      <description>&lt;p&gt;Very first we need to download &lt;a href="https://git-scm.com/downloads"&gt;Git&lt;/a&gt;.&lt;br&gt;
Set up a folder as a Git repository. and follow along ~&lt;/p&gt;
&lt;h4&gt;
  
  
  Basic Git Commands
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;At a convenient location on your computer, create a folder named git-test.&lt;/li&gt;
&lt;li&gt;Open this git-test folder in your favorite editor.
Add a file named &lt;code&gt;index.html&lt;/code&gt; to this folder, and add the following HTML code to this file:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;

    &amp;lt;body&amp;gt;
        &amp;lt;h1&amp;gt;This is a Header&amp;lt;/h1&amp;gt;
    &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;3.Initializing the folder as a Git repository.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Go to the git-test folder in your cmd window/terminal and type the following at the prompt to initialize the folder as a Git repository:&lt;/em&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 init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.Checking your Git repository status.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Type the following at the prompt to check your Git repository's status:&lt;/em&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 status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.Adding files to the staging area&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To add files to the staging area of your Git repository, type:&lt;/em&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 add .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6.Commiting to the Git repository&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To commit the current staging area to your Git repository, type:&lt;/em&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 commit -m "first commit"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7.Checking the log of Git commits&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To check the log of the commits to your Git repository, type:&lt;/em&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 log --oneline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Now, modify the &lt;code&gt;index.html&lt;/code&gt; file as follows:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;

    &amp;lt;body&amp;gt;
        &amp;lt;h1&amp;gt;This is a Header&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;This is a paragraph&amp;lt;/p&amp;gt;
    &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Add a sub-folder named templates to your git-test folder, and then add a file named &lt;code&gt;test.html&lt;/code&gt; to the templates folder. Then set the contents of this file to be the same as the &lt;code&gt;index.html&lt;/code&gt; file above.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then check the status and add all the files to the staging area.&lt;/li&gt;
&lt;li&gt;Then do the second commit to your repository&lt;/li&gt;
&lt;li&gt;Now, modify the &lt;code&gt;index.html&lt;/code&gt; file as follows:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;

    &amp;lt;body&amp;gt;
        &amp;lt;h1&amp;gt;This is a Header&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;This is a paragraph&amp;lt;/p&amp;gt;
        &amp;lt;p&amp;gt;This is a second paragraph&amp;lt;/p&amp;gt;
    &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now add the modified &lt;code&gt;index.html&lt;/code&gt; file to the staging area and then do a third commit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;8.Checking out a file from an earlier commit&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To check out the &lt;code&gt;index.html&lt;/code&gt; from the second commit, find the number of the second commit using the git log, and then type the following at the prompt:&lt;/em&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 checkout &amp;lt;second commit's number&amp;gt; index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;9.Resetting the Git repository&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To discard the effect of the previous operation and restore &lt;code&gt;index.html&lt;/code&gt; to its state at the end of the third commit, type:&lt;/em&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 reset HEAD index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Then type the following at the prompt:&lt;/em&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 checkout -- index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;10.You can also use git reset to reset the staging area to the last commit without disturbing the working directory.&lt;/p&gt;

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

&lt;blockquote&gt;
&lt;p&gt;This is the end of some basic Git commands. Experiment with these and more git commands...KEEP EXPERIMENTING.&lt;/p&gt;
&lt;/blockquote&gt;

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