<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>git &#8211; abdulrahmanuk.com</title>
	<atom:link href="https://www.abdulrahmanuk.com/tag/git/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.abdulrahmanuk.com</link>
	<description>All about Cloud and DevOps</description>
	<lastBuildDate>Thu, 17 Apr 2025 21:11:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.abdulrahmanuk.com/wp-content/uploads/2023/02/icons8-devops-60.png</url>
	<title>git &#8211; abdulrahmanuk.com</title>
	<link>https://www.abdulrahmanuk.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Day 8 Task &#8211; Basics Of Git &#038; GitHub</title>
		<link>https://www.abdulrahmanuk.com/day-8-task-basics-of-git-github/</link>
		
		<dc:creator><![CDATA[Abdul Rahman UK]]></dc:creator>
		<pubDate>Sat, 03 Jun 2023 04:52:41 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<guid isPermaLink="false">https://www.abdulrahmanuk.com/?p=394</guid>

					<description><![CDATA[<p>#90DaysOfDevopsChallenge If you are working in Software Industry must hear about the two-term &#8220;Git and GitHub&#8221; but before jumping into git first, you have to understand what version control is and what issue the software industry was facing before git. What is Version Control System? A version control system is software that tracks changes to a [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.abdulrahmanuk.com/day-8-task-basics-of-git-github/">Day 8 Task &#8211; Basics Of Git &#038; GitHub</a> appeared first on <a rel="nofollow" href="https://www.abdulrahmanuk.com">abdulrahmanuk.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><strong>#90DaysOfDevopsChallenge</strong></p>



<p>If you are working in Software Industry must hear about the two-term &#8220;<strong>Git and</strong> <strong>GitHub</strong>&#8221; but before jumping into git first, you have to understand what version control is and what issue the software industry was facing before git.</p>



<h3 class="wp-block-heading" id="heading-what-is-version-control-system"><strong><mark>What is Version Control System?</mark></strong></h3>



<p>A version control system is software that tracks changes to a file or set of files over time so that you can recall specific versions later. It also allows you to work together with other programmers.</p>



<p>The version control system is a collection of software tools that help a team to manage changes in a source code. It uses a special kind of database to keep track of every modification to the code.</p>



<p>Developers can compare earlier versions of the code with an older version to fix the mistakes.</p>



<h3 class="wp-block-heading" id="heading-benefits"><strong><mark>Benefits</mark></strong></h3>



<ul class="wp-block-list">
<li>Enhances the project development speed by providing efficient collaboration.</li>



<li>Reduce possibilities of errors and conflicts meanwhile project development through traceability to every small change.</li>



<li>Employees or contributors of the project can contribute from anywhere irrespective of the different geographical locations through this&nbsp;<strong>VCS</strong></li>



<li>For each different contributor to the project, a different working copy is maintained and not merged to the main file unless the working copy is validated.</li>



<li>Informs us about Who, What, When, and Why changes have been made.</li>



<li>Helps in recovery in case of any disaster situation</li>
</ul>



<h3 class="wp-block-heading" id="heading-types-of-vcs"><strong><mark>Types of VCS</mark></strong></h3>



<p>1. Centralized Version Control Systems</p>



<p>2. Distributed Version Control Systems</p>



<h3 class="wp-block-heading" id="heading-benefits"><strong><mark>Centralized Version Control Systems :</mark></strong></h3>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1508" height="968" src="https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-6.png" alt="image 6" class="wp-image-395" title="Day 8 Task - Basics Of Git &amp; GitHub 1" srcset="https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-6.png 1508w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-6-768x493.png 768w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-6-150x96.png 150w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-6-300x193.png 300w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-6-696x447.png 696w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-6-1068x686.png 1068w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-6-600x385.png 600w" sizes="(max-width: 1508px) 100vw, 1508px" /></figure>



<h4 class="wp-block-heading" id="heading-benefits">Centralized version control systems contain just one repository globally and every user needs to commit for reflecting one’s changes in the repository. Others can see your changes by updating.<a href="https://tanaya.hashnode.dev/basics-of-git-github-day-8-task#heading-benefits" rel="nofollow noopener" target="_blank"></a></h4>



<h3 class="wp-block-heading" id="heading-cvcs-has-some-drawbacks-and-the-problem-was"><strong><mark>CVCS has some drawbacks and the problem was,</mark></strong></h3>



<p>a) It is not locally available, meaning you always need to be connected to a network to perform any actions.</p>



<p>b) Since everything is centralized, if Central Server gets failed, you will lose the entire data.</p>



<p>Central Repository or Central Server means,it is a kind of storage or folder in a remote server, where you or anyone can keep your code and can see that code or can access it.</p>



<h3 class="wp-block-heading" id="heading-distributed-version-control-systems"><strong><mark>Distributed Version Control Systems</mark></strong><br><a href="https://tanaya.hashnode.dev/basics-of-git-github-day-8-task#heading-distributed-version-control-systems" rel="nofollow noopener" target="_blank"></a></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="1504" height="1066" src="https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-7.png" alt="image 7" class="wp-image-396" title="Day 8 Task - Basics Of Git &amp; GitHub 2" srcset="https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-7.png 1504w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-7-768x544.png 768w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-7-150x106.png 150w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-7-300x213.png 300w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-7-696x493.png 696w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-7-1068x757.png 1068w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-7-600x425.png 600w" sizes="(max-width: 1504px) 100vw, 1504px" /></figure>



<ol class="wp-block-list">
<li>In a DVCS, every developer has a full copy of the repository, including the entire history of all changes. This makes it easier for developers to work together, as they don&#8217;t have to constantly communicate with a central server to commit their changes or to see the changes made by others.</li>



<li>Because developers have a local copy of the repository, they can commit their changes and perform other version control actions faster, as they don&#8217;t have to communicate with a central server.</li>



<li>With a DVCS, developers can work offline and commit their changes later when they do have an internet connection. They can also choose to share their changes with only a subset of the team, rather than pushing all of their changes to a central server.</li>



<li>In a DVCS, the repository history is stored on multiple servers and computers, which makes it more resistant to data loss.</li>
</ol>



<p><strong><mark>Git is an example of DVCS.</mark></strong></p>



<h3 class="wp-block-heading" id="heading-difference-between-cvcs-and-dvcs"><a href="https://tanaya.hashnode.dev/basics-of-git-github-day-8-task#heading-difference-between-cvcs-and-dvcs" rel="nofollow noopener" target="_blank"></a><strong><mark>Difference between CVCS and DVCS</mark></strong></h3>



<p>1. In CVCS, a client need to get a local copy of the source from the server, do the changes and commit those changes to the central source on the server, while in DVCS each client can have a local branch or repository as well and have a complete history on it. The client needs to push the changes to the branch which will then be pushed to the server repository.</p>



<p>2. CVCS systems are easy to learn and set up, and DVCS systems are difficult for beginners. Multiple commands need to be remembered.</p>



<p>3. Working on branches is difficult in CVCS, Developer often faces Merge Conflict. Working on branches is easier in DVCS, developers face less conflict.</p>



<p>4. CVCS systems do not provide offline access. DVCS systems are working fine in offline mode as a client copies the entire repository on their local machine.</p>



<p>5. CVCS is slower as every command needs to communicate with the server. while DVCS is faster as most user deals with a local copy without hitting the server every time.</p>



<p>6. If the CVCS server goes down, the developer is not able to do the work. But if the DVCS server is down, developers can work using their local copies.</p>



<h3 class="wp-block-heading" id="heading-github"><strong><mark>GitHub</mark></strong></h3>



<p>Git and GitHub are not the same things, Git mainly works on local systems. Github is used to store code that is remotely centralized and most Developers use this to store their code. GitHub is the largest host of source code in the world and has been owned by Microsoft since 2018.</p>



<h3 class="wp-block-heading" id="heading-git"><a href="https://tanaya.hashnode.dev/basics-of-git-github-day-8-task#heading-git" rel="nofollow noopener" target="_blank"></a><strong><mark>Git</mark></strong></h3>



<p>Git is a Distributed Version Control System and was launched by&nbsp;<strong>Linus Torvald</strong>&nbsp;&amp; this person also introduced Linux. Git is a software tool.</p>



<p>It is used for:</p>



<ul class="wp-block-list">
<li>Tracking code changes</li>



<li>Tracking who made changes</li>



<li>Coding collaboration</li>
</ul>



<h3 class="wp-block-heading" id="heading-what-does-git-do"><a href="https://tanaya.hashnode.dev/basics-of-git-github-day-8-task#heading-what-does-git-do" rel="nofollow noopener" target="_blank"></a>What does Git do?</h3>



<ul class="wp-block-list">
<li>Manage projects with&nbsp;<strong>Repositories</strong></li>



<li><strong>Clone</strong>&nbsp;a project to work on a local copy</li>



<li>Control and track changes with&nbsp;<strong>Staging</strong>&nbsp;and&nbsp;<strong>Committing</strong></li>



<li><strong>Branch</strong>&nbsp;and&nbsp;<strong>Merge</strong>&nbsp;to allow for work on different parts and versions of a project</li>



<li><strong>Pull</strong>&nbsp;the latest version of the project to a local copy</li>



<li><strong>Push</strong>&nbsp;local updates to the main project</li>
</ul>



<p><strong><mark>Actual Workflow of Git</mark></strong></p>



<figure class="wp-block-image size-full"><img decoding="async" width="1752" height="1240" src="https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-8.png" alt="image 8" class="wp-image-397" title="Day 8 Task - Basics Of Git &amp; GitHub 3" srcset="https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-8.png 1752w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-8-768x544.png 768w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-8-1536x1087.png 1536w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-8-150x106.png 150w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-8-300x212.png 300w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-8-696x493.png 696w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-8-1068x756.png 1068w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-8-600x425.png 600w" sizes="(max-width: 1752px) 100vw, 1752px" /></figure>



<ol class="wp-block-list">
<li>Initialize Git on a folder, making it a local <strong>Repository</strong> by the <strong><mark>git init </mark>command.</strong> A hidden folder will create named <strong><mark>.git</mark></strong></li>



<li><strong>Clone</strong>&nbsp;a project to work on a local copy</li>



<li><strong><mark>Working directory and Staging area</mark></strong><mark>:</mark>&nbsp;this is where you see files physically and do modifications. At a time you can work on a particular branch. When we send our code to the staging area to finalize our code from the working space, this procedure is known as&nbsp;<strong><mark>Add</mark></strong>In other CVCS, developers generally make modifications and commit their changes directly to the Repository (central). But Git uses a different strategy. Git does not track every modified file. Whenever you do commit an operation, Git looks for the files present in the staging area. Only those files present in the staging area are considered for commit and not all the modified files.</li>



<li><strong><mark>Commit</mark></strong><mark>:</mark>&nbsp;From the staging area when we send our codes to the local Repository this process will be known as Commit (save/snapshot). After saving the code, a commit id will be created &amp; this is unique.<strong><mark>Commit Id</mark>:</strong>&nbsp;So if anyone needs to check any code later time, then they can check it through that commit id. Commit-ID is 40 alpha-numeric characters. It mainly uses the&nbsp;<strong>SHA-1</strong>&nbsp;checksum concept. Even if you change one dot, the commit-id will get changed. It helps you to track the changes. Commit is also known as SHA-Hash.</li>



<li><strong><mark>Snapshot</mark></strong><mark>:</mark>&nbsp;It is that when you keep the codes into a file &amp; when you change some code, eg:you change into 4-5 lines then when you take a snapshot of that file, the snapshot will copy only that 4-5 lines of code in another file, not the entire code. So this helps to save less storage of a file.Snapshot is incremental i.e. it will copy or save only the changed data.</li>



<li><strong><mark>Push</mark></strong><mark>:</mark>&nbsp;Push operation copies changes from a local Repository instance to a Remote or Central Repo(<strong>GitHub</strong>). This is used to store the changes permanently in the Git Repo.</li>



<li><strong><mark>Pull:&nbsp;</mark></strong>Pull Operation copies the changes from a Remote Repo to a local machine. The pull operation is used for synchronization between two repo.</li>



<li><strong><mark>Branch:</mark></strong> There is an important concept of the branch&#8230;</li>
</ol>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1624" height="850" src="https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-9.png" alt="image 9" class="wp-image-398" title="Day 8 Task - Basics Of Git &amp; GitHub 4" srcset="https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-9.png 1624w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-9-768x402.png 768w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-9-1536x804.png 1536w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-9-150x79.png 150w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-9-300x157.png 300w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-9-696x364.png 696w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-9-1068x559.png 1068w, https://www.abdulrahmanuk.com/wp-content/uploads/2023/06/image-9-600x314.png 600w" sizes="auto, (max-width: 1624px) 100vw, 1624px" /></figure>



<p>The diagram above visualizes a repository with two isolated lines of development. By developing them as branches, it&#8217;s not only possible to work on both of them in parallel, but it also keeps the main&nbsp;<strong><mark>Master (default branch)&nbsp;</mark></strong>free from error.</p>



<ul class="wp-block-list">
<li>Each task has one separate branch.</li>



<li>After done with the code,&nbsp;<strong><mark>Merge other Branches with the Master.</mark></strong></li>



<li>This concept is useful for parallel development means at times many persons can work on their branch and that won&#8217;t reflect on the main branch.</li>



<li>you can create any number of branches.</li>



<li>Changes are personal to that particular branch.</li>



<li><mark>The default branch is Master.</mark></li>



<li><mark>Files created in Workspace will be visible in any of the branch workspaces until you commit. Once you commit, then that file belongs to that particular branch.</mark></li>



<li><mark>When creating a new branch, data from the existing Branch is copied to the new branch (only one time when the branch is created).</mark></li>
</ul>



<h3 class="wp-block-heading" id="heading-tasks"><strong><mark>Tasks</mark></strong></h3>



<h3 class="wp-block-heading" id="heading-1-install-git-on-your-system"><a href="https://tanaya.hashnode.dev/basics-of-git-github-day-8-task#heading-1-install-git-on-your-system" rel="nofollow noopener" target="_blank"></a><strong>1. Install git on your system</strong></h3>



<p>As am using Linux OS(Ubuntu ) so by default git is already installed in it ( Aws instance). My git version is&nbsp;<strong>2.34.1</strong></p>



<h3 class="wp-block-heading" id="heading-2-create-a-free-account-in-github"><a href="https://tanaya.hashnode.dev/basics-of-git-github-day-8-task#heading-2-create-a-free-account-in-github" rel="nofollow noopener" target="_blank"></a><strong>2. Create a free account in GitHub.</strong></h3>



<p>You can create a free account in GitHub by Signing up&nbsp;<a target="_blank" href="https://github.com/" rel="noreferrer noopener nofollow"><strong></strong></a><strong><a href="https://github.com/" target="_blank" rel="noreferrer noopener nofollow">github.com</a></strong>&nbsp;(use this link).</p>



<h3 class="wp-block-heading" id="heading-3-make-a-directory-and-make-it-a-local-repository-by-git-init-command"><a href="https://tanaya.hashnode.dev/basics-of-git-github-day-8-task#heading-3-make-a-directory-and-make-it-a-local-repository-by-git-init-command" rel="nofollow noopener" target="_blank"></a><strong>3. Make a directory and make it a local repository by the git init command</strong></h3>



<p>Created one directory as <strong>test-repository</strong> then changed the directory to it. Then made it a git repository with <strong><mark>git init</mark> command.</strong>A .git folder will be created that is hidden</p>



<h3 class="wp-block-heading" id="heading-4-create-a-new-repository-on-github-and-clone-it-to-your-local-machine"><a href="https://tanaya.hashnode.dev/basics-of-git-github-day-8-task#heading-4-create-a-new-repository-on-github-and-clone-it-to-your-local-machine" rel="nofollow noopener" target="_blank"></a><strong>4. Create a new repository on GitHub and clone it to your local machine</strong></h3>



<p>Created one repository in GitHub named&nbsp;<strong>Task-Repo and</strong>&nbsp;cloned it to my machine.</p>



<h3 class="wp-block-heading" id="heading-5-make-some-changes-to-a-file-in-the-repository-and-commit-them-to-the-repository-using-git"><a href="https://tanaya.hashnode.dev/basics-of-git-github-day-8-task#heading-5-make-some-changes-to-a-file-in-the-repository-and-commit-them-to-the-repository-using-git" rel="nofollow noopener" target="_blank"></a><strong>5. Make some changes to a file in the repository and commit them to the repository using Git</strong></h3>



<p>Cloned the repository that I created in GitHub by the url in my machine.</p>



<p>configured git with git config &#8211;global user.name and user.email (this will help to check who is committed by name and mail id) command.</p>



<p>Now chnaged to the repository that I cloned. Then created a file called devops.txt.</p>



<p>add the file by <strong><mark>git add &lt;filename> </mark></strong>command and check the git status. This file is now <strong>staged</strong>. Now commit the file by the <strong><mark>git commit command.</mark></strong></p>



<h3 class="wp-block-heading" id="heading-6-push-the-changes-back-to-the-repository-on-github">6.&nbsp;<strong>Push the changes back to the repository on GitHub</strong></h3>



<p>Now add the repository by the command <strong><mark>git remote add origin</mark> &lt;url of GitHub repo</strong>></p>



<p>Then I pushed the committed file into GitHub by the command&nbsp;<strong><mark>git push origin main (as my default branch is main here, it can be master sometimes too).</mark></strong></p>



<p><strong><mark>While pushing the file into github have to enter the GitHub username and Personal access token ( go to Developers settings in GitHub -&gt; personal access token-&gt;generate token)</mark></strong></p>
<p>The post <a rel="nofollow" href="https://www.abdulrahmanuk.com/day-8-task-basics-of-git-github/">Day 8 Task &#8211; Basics Of Git &#038; GitHub</a> appeared first on <a rel="nofollow" href="https://www.abdulrahmanuk.com">abdulrahmanuk.com</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
