<?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: kramnev</title>
    <description>The latest articles on DEV Community by kramnev (@kramnev).</description>
    <link>https://dev.to/kramnev</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%2F1284184%2F35acc335-89c4-4523-a33f-cef8b60a831d.jpeg</url>
      <title>DEV Community: kramnev</title>
      <link>https://dev.to/kramnev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kramnev"/>
    <language>en</language>
    <item>
      <title>Introduction to GIT Version Control</title>
      <dc:creator>kramnev</dc:creator>
      <pubDate>Tue, 20 Feb 2024 01:24:48 +0000</pubDate>
      <link>https://dev.to/up_min_sparcs/introduction-to-git-version-control-2pcl</link>
      <guid>https://dev.to/up_min_sparcs/introduction-to-git-version-control-2pcl</guid>
      <description>&lt;p&gt;This Article was co-authored by &lt;a class="mentioned-user" href="https://dev.to/gadu30"&gt;@gadu30&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;        In the world of programming, teamwork and collaboration are common. Updating files and tracking changes can be tough when working on projects. Therefore, learning version control is essential to keep things tidy, under control, and manage changes to documents, programs, and directories. This is where GIT steps in, it is a &lt;strong&gt;Distributed Version Control System (DVCS)&lt;/strong&gt; that can record different versions of a project, bring back any of these versions instantly, and smoothly combine changes from different project branches. This makes Git a robust and well-known Version Control System (VCS) today. This article aims to give a clear introduction to Git Version Control.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is GIT?
&lt;/h2&gt;

&lt;p&gt;        &lt;strong&gt;Git&lt;/strong&gt; is a popular version control system primarily used for programming and project management. It is an open-source tool and is made to easily track from solo projects to complex collaborative projects with a large number of contributors. It’s important to note that Git is not the same as GitHub. However, learning and understanding the fundamentals of Git can help you effectively use any Git-based platform, such as Azure, BitBucket, Sourceforge, GitLab, Codebase, and more. Among this, it is still common to use GIT with GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Version Control?
&lt;/h2&gt;

&lt;p&gt;        According to Atlassian (n.d.), &lt;strong&gt;Version control&lt;/strong&gt;, also known as source control, is the practice of tracking and managing changes to software code. Version control systems are software tools that help manage changes to source code over time such as adding new lines, simplifying/revising existing lines, or simply removing lines from the existing code. Version control offers a lot of help for developers not only for those who have been in the industry for a long time, but also for those who are beginners who are willing to learn more and practice coding. It also offers protection for the source code from being ruined or casual degradation of human error and unintended consequences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of GIT
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Makes branching and merging easy. It is cheap, fast, and consumes very little space so that you can branch whenever you want. &lt;/li&gt;
&lt;li&gt;Allows you to save different versions of a file, making any versions to be retrieved anytime, comparing between versions is also possible.&lt;/li&gt;
&lt;li&gt;It is compatible with a large range of platforms such as Windows, macOS, and Linux, and also supports various protocols such as HTTP, SSH, and Git protocol.&lt;/li&gt;
&lt;li&gt;It maintains a detailed history of all changes made to the source code. This data includes who made the changes, when they were made, and the nature of the changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Disadvantages of GIT
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It has a steeper learning curve compared to simpler version control systems. It has a lot of features and commands that may be challenging to grasp for some users new to version control. &lt;/li&gt;
&lt;li&gt;It can also experience slowdowns in large repositories with a long history such as operations like cloning, fetching, and merging. &lt;/li&gt;
&lt;li&gt;GIT also lacks strict access control mechanisms. While it has basic user authentication, more advanced access control features are typically implemented by integrating GIT with additional services.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Install GIT
&lt;/h2&gt;

&lt;p&gt;To install GIT in Windows, you can refer to this link: &lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://phoenixnap.com/kb/how-to-install-git-windows" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ELoF78io--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://phoenixnap.com/kb/wp-content/uploads/2021/04/install-and-configure-git-on-windows.png" height="401" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://phoenixnap.com/kb/how-to-install-git-windows" rel="noopener noreferrer" class="c-link"&gt;
          How to Install Git on Windows {Step-by-Step Tutorial} - PhoenixNAP
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          In this tutorial, you’ll learn how to install and set up Git on Windows. Start taking control of your developers work flow with Git.
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
        phoenixnap.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
For MacOs and Linux, refer to this link: &lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noopener noreferrer"&gt;
      git-scm.com
    &lt;/a&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Using GIT
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Checking Versions of GIT
&lt;/h3&gt;

&lt;p&gt;      Before we actually use GIT, we must make sure that we have GIT downloaded in our systems. To check this, we can prompt into the cmd or the Command Prompt &lt;code&gt;git --version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F90gon0eyan485cbeniyb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F90gon0eyan485cbeniyb.png" alt="Image description" width="395" height="68"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  GIT Workflow
&lt;/h3&gt;

&lt;p&gt;Git has three main states wherein your files can reside in: modified, staged and committed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the modified state, it means that you have changed/edited the file but you have not committed it to your main repository. &lt;/li&gt;
&lt;li&gt;In the staged state, it means you have marked a modified file in its current version to go into your next commit prompt. &lt;/li&gt;
&lt;li&gt;The committed state means that the data is finalized and stored in your main repository. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuv58mfpjplxrofc43ogo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuv58mfpjplxrofc43ogo.png" alt="Image description" width="800" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Making a GIT Repository
&lt;/h3&gt;

&lt;p&gt;&lt;u&gt;Local Directory&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open GIT Bash and change directory to desired location.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fett7tbugln4x3na98t9x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fett7tbugln4x3na98t9x.png" alt="Image description" width="760" height="108"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Issue a &lt;code&gt;git init&lt;/code&gt; command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fed1mqbhf62zgxzqj6913.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fed1mqbhf62zgxzqj6913.png" alt="Image description" width="776" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To make sure whether it is a git repository, we can issue &lt;code&gt;ls -a&lt;/code&gt; to check if there is a .git directory in the repository. This directory is hidden because it is not meant to be seen by users and works primarily to store information for programs to run. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiphz8j1qjmogu8bqr82o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiphz8j1qjmogu8bqr82o.png" alt="Image description" width="737" height="86"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Cloning an Existing Repository&lt;/u&gt;&lt;br&gt;
       To be able to collaborate and contribute on an existing project or repository. Cloning it into your local device makes collaboration easier as it copies the entire data that the server has including the version history of the repository which makes it easier to retrieve past versions of the files or compare different versions of the file itself.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;git clone &amp;lt;url&amp;gt;&lt;/code&gt; is used to clone an existing repository.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F71t4yoiel0gzhg8jde5k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F71t4yoiel0gzhg8jde5k.png" alt="Image description" width="778" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Checking the Status of the Repository
&lt;/h3&gt;

&lt;p&gt;       As we start to work on a repository, modifying a file and saving it is a common thing to do.  At some point we need to commit it to the main server for it to make changes. To check the status of the files in which state there are, whether untracked, tracked, modified, staged, or committed we can issue a git status command. It also shows which branch we are currently working on, in this case is the master/main branch. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyhqm2nh0lqg2p01badxx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyhqm2nh0lqg2p01badxx.png" alt="Image description" width="779" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding a New File
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Making a simple file that has the text "Hello World" inside the file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcxe7nb28yr282urdum98.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcxe7nb28yr282urdum98.png" alt="Image description" width="778" height="61"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next, is to check the status of the file, in this case it is still in the untracked phase.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwxzgz55ekhpl3tb5lsdn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwxzgz55ekhpl3tb5lsdn.png" alt="Image description" width="772" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then, we move it to the staged phase by issuing the &lt;code&gt;git add&lt;/code&gt; command and after it is to check the status of the SAMPLE file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1aej65evnly43gj2034c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1aej65evnly43gj2034c.png" alt="Image description" width="780" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you have nothing else to change or edit, you can commit the changes in the main server. Committing to main will launch a text editor that will let you prompt a commit message.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw67wwv0emu50tpn4zluu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw67wwv0emu50tpn4zluu.png" alt="Image description" width="780" height="119"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Comparing Changes
&lt;/h3&gt;

&lt;p&gt;       When comparing versions of a file, we can simply use the &lt;code&gt;git status&lt;/code&gt; command to know if there are any changes made in the file. However, if you want to know the detailed changes made “inside” the file we can issue the &lt;code&gt;git diff&lt;/code&gt; command or use &lt;code&gt;git diff --staged&lt;/code&gt;. The basic use of this command is to help you understand the changes and compare it from the last version of the file. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62eawpmaehzpcbhuxlnu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62eawpmaehzpcbhuxlnu.png" alt="Image description" width="778" height="245"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;       In conclusion, learning Git Version Control is a valuable skill for anyone especially in the tech field. It provides a robust and flexible system for tracking changes, collaborating with others, and managing different versions of a project. By learning Git, you gain the ability to work more efficiently and effectively.Furthermore, Git is widely used in the industry, making it a vital tool for growth. Overall, understanding Git can significantly enhance your coding journey even if you are still a beginner or a seasoned developer.&lt;/p&gt;

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