<?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: Fatema Moharam</title>
    <description>The latest articles on DEV Community by Fatema Moharam (@moharamfatema).</description>
    <link>https://dev.to/moharamfatema</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%2F915463%2Fca5a22f3-e641-4acc-a794-4e8240ca57dc.png</url>
      <title>DEV Community: Fatema Moharam</title>
      <link>https://dev.to/moharamfatema</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/moharamfatema"/>
    <language>en</language>
    <item>
      <title>Git: A practical guide</title>
      <dc:creator>Fatema Moharam</dc:creator>
      <pubDate>Fri, 28 Jul 2023 19:01:07 +0000</pubDate>
      <link>https://dev.to/moharamfatema/git-a-practical-guide-no1</link>
      <guid>https://dev.to/moharamfatema/git-a-practical-guide-no1</guid>
      <description>&lt;p&gt;In the &lt;a href="https://dev.to/moharamfatema/series/21876"&gt;previous posts of this series&lt;/a&gt;, we covered &lt;a href="https://dev.to/moharamfatema/can-someone-tell-me-what-a-repo-is-43al"&gt;the basics of version control systems&lt;/a&gt; and &lt;a href="https://dev.to/moharamfatema/git-the-basics-akc"&gt;Git fundamentals&lt;/a&gt;. We introduced the advantages of using Git and provided installation guides for Linux, Windows, and macOS. Now, it's time to start using Git and create your first repository. This tutorial will guide you through the process of creating a Git repository and illustrate how to use various Git commands along the way. Whether you're a beginner or you just need a refresher, this tutorial is for you. Let's dive in!&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a Repository
&lt;/h3&gt;

&lt;p&gt;While it's possible to create a repository at any point during the development process, it's always a good practice to create one early on. This is especially true if you're working with a team. By creating a repository early, you'll be able to keep your code organized from the beginning and avoid potential headaches down the line.&lt;/p&gt;

&lt;p&gt;To get started, let's go ahead and create a new folder on the desktop, I'll call it &lt;code&gt;git-demo&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To create a git repository, open up a terminal window (CMD or Powershell on Windows) and navigate to the directory where you'd like to create your repository. You can do that either with the &lt;code&gt;cd&lt;/code&gt; command, which means Change Directory, like the following:&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="nb"&gt;cd &lt;/span&gt;desktop/git-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or if you're on Windows, you can also right-click anywhere inside the folder and choose &lt;code&gt;Git Bash Here&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Once you're there, run the following command to initialize a new 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;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new (hidden) directory named &lt;code&gt;.git&lt;/code&gt; in your current directory, which will serve as the backbone of your repository. You can think of this directory as a hidden database that tracks all changes made to your code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Track Your Code: Staging
&lt;/h3&gt;

&lt;p&gt;Let's write some code, shall we?&lt;/p&gt;

&lt;p&gt;Create a new Python file called &lt;code&gt;hello.py&lt;/code&gt; using your favourite code editor. This file will contain the shortest program in history:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Hello World!'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Right now, our file is not tracked by Git, meaning any changes we make to it won't be saved in Git's history. To track changes to our file, we need to stage it using the following command in the terminal:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;git add&lt;/code&gt; command adds our file to Git's staging area, which means Git will start tracking changes to the file. The &lt;code&gt;git add&lt;/code&gt; command can take arguments like file names, directory names, or wildcards to add multiple files at once. If we want to track all the files in our directory, we can write&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Committing Changes
&lt;/h3&gt;

&lt;p&gt;Once you've staged your changes, you're ready to commit them to your repository using the &lt;code&gt;git commit&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;git commit&lt;/code&gt; command creates a new commit with the changes we've staged. The &lt;code&gt;-m&lt;/code&gt; flag allows us to add a commit message describing the changes we've made. Commit messages should be clear and concise and describe the changes made in the commit.&lt;/p&gt;

&lt;h4&gt;
  
  
  Good Practices for Git Commits
&lt;/h4&gt;

&lt;p&gt;To ensure that commits are effective and easy to manage, there are several good practices to follow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Keep commits small and focused: A commit should contain a single logical change or feature. This makes it easier to review and understand the changes made to the codebase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Write clear commit messages: A commit message should be descriptive and explain the changes made in the commit. This helps other developers understand what has been changed and why.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use the present tense and imperative mood in commit messages: Commit messages should start with a verb in the present tense, such as "Add," "Fix," or "Update." This makes it clear what action was taken in the commit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Commit frequently: Committing frequently allows for better tracking of changes and makes it easier to revert to previous versions if necessary.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Status command
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;git status&lt;/code&gt; command is a useful tool in Git that shows the current status of your repository. It displays the state of the working directory and the staging area. When you run this command, Git will tell you which files have been modified, which files are staged, and which files are not tracked.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;git status&lt;/code&gt; command allows you to keep track of your changes and see which files are ready to be committed. It will tell you if the file is modified but not yet staged, or if it has been staged and is ready to be committed.&lt;/p&gt;

&lt;p&gt;In addition, &lt;code&gt;git status&lt;/code&gt; also provides information about untracked files. Untracked files are files that are not yet added to the repository and are not being tracked by Git. This can help you keep track of changes to your code and ensure that everything is properly tracked. Let's run it in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Branches
&lt;/h2&gt;

&lt;p&gt;Let's dive into branches and the &lt;code&gt;git checkout&lt;/code&gt; command.&lt;/p&gt;

&lt;h3&gt;
  
  
  git branch
&lt;/h3&gt;

&lt;p&gt;Git Branches: In Git, branches are like parallel timelines that allow you to work on different features, fixes, or experiments without affecting the main codebase. You can think of branches as separate workspaces where you can freely create, modify, and delete code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Renaming a branch: If you want to rename an existing branch, you can use &lt;code&gt;git branch -M new_name&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating a new branch: To create a new branch, use the &lt;code&gt;git branch&lt;/code&gt; command followed by the branch name. For example, &lt;code&gt;git branch new_feature&lt;/code&gt; will create a new branch called "new_feature."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Listing branches: To see a list of all branches in your repository, you can use &lt;code&gt;git branch -v&lt;/code&gt;. It will show you all the branches along with their latest commits.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Viewing all branches: To see both local and remote branches, you can use &lt;code&gt;git branch -a&lt;/code&gt;. This will display a list of all branches available in your local repository as well as the remote repository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deleting a branch: To delete a branch that you no longer need, use &lt;code&gt;git branch -d branch_name&lt;/code&gt;. If the branch has unmerged changes, you can use &lt;code&gt;git branch -D branch_name&lt;/code&gt; to force delete it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  git checkout
&lt;/h3&gt;

&lt;p&gt;Git Checkout: The &lt;code&gt;git checkout&lt;/code&gt; command allows you to switch between different branches in your repository. It's like teleporting between different timelines, letting you work on specific branches at different times.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Creating and switching to a new branch: To create and switch to a new branch at the same time, use &lt;code&gt;git checkout -b new_branch_name&lt;/code&gt;. For example, &lt;code&gt;git checkout -b feature_branch&lt;/code&gt; will create a new branch called "feature_branch" and switch to it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Switching to an existing branch: If you want to move to an existing branch, use &lt;code&gt;git checkout existing_branch_name&lt;/code&gt;. For example, &lt;code&gt;git checkout main&lt;/code&gt; will switch you to the "main" branch.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  git merge
&lt;/h3&gt;

&lt;p&gt;Git Merge: Branches are often used to work on separate features, and once those features are ready, you can merge them back into the main codebase using the &lt;code&gt;git merge&lt;/code&gt; command. It brings changes from one branch into another, creating a cohesive and up-to-date project.&lt;/p&gt;

&lt;p&gt;Let's walk through some examples of using the &lt;code&gt;git merge&lt;/code&gt; command.&lt;/p&gt;

&lt;h4&gt;
  
  
  Fast-forward merge
&lt;/h4&gt;

&lt;p&gt;Let's say we have two branches: "main" and "feature_branch." The "feature_branch" has completed its development, and now we want to bring those changes into the "main" branch.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, switch to the "main" branch:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Then, merge the changes from "feature_branch" into "main":
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git merge feature_branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this scenario, if there are no conflicting changes between the two branches, Git performs a fast-forward merge. It moves the "main" branch pointer forward to the latest commit of "feature_branch," incorporating all the changes smoothly.&lt;/p&gt;

&lt;h4&gt;
  
  
  Merge with conflicts
&lt;/h4&gt;

&lt;p&gt;Let's consider a situation where both the "main" and "bug_fix" branches have made changes to the same file, resulting in a conflict.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, switch to the "main" branch:
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Now, merge the changes from "bug_fix" into "main":
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;



&lt;p&gt;If Git detects conflicts between the changes, it will pause the merge process and prompt you to resolve the conflicts manually. You'll need to open the conflicting file, identify and choose which changes to keep, save the file, and then commit the resolution.&lt;/p&gt;

&lt;h4&gt;
  
  
  Merge with a commit message
&lt;/h4&gt;

&lt;p&gt;You can provide a custom commit message while merging to provide more context about the changes being merged.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, switch to the branch you want to merge into, for example, "main":
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Merge the changes from the other branch, say "feature_branch," with a custom commit message:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git merge feature_branch -m "Merge feature_branch into main: Add new feature XYZ"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way, you can add a descriptive commit message that helps others understand the reason for the merge and what changes were introduced.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it out
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Rename a branch
&lt;/h3&gt;

&lt;p&gt;It's common practice to have your default branch called "main", so let's rename the current branch to "main". In your terminal, write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add a new feature
&lt;/h3&gt;

&lt;p&gt;Now, let's create a new branch to implement the feature "greeting".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch greeting-feature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then switch to the newly created branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout greeting-feature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or we can combine both of the previous commands in one command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; greeting-feature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we'll make some changes in the &lt;code&gt;hello.py&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Hello World!'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Enter your name: '&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;'Hello, &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;! Nice to meet you.'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can now add and commit the changes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-am&lt;/span&gt; &lt;span class="s2"&gt;"add greeting by name"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git commit -am &amp;lt;message&amp;gt;&lt;/code&gt; is a shortcut to stage and commit changes to tracked files in one step. The &lt;code&gt;-a&lt;/code&gt; flag automatically stages modified or deleted files. The &lt;code&gt;-m &amp;lt;message&amp;gt;&lt;/code&gt; flag lets you add a commit message directly in the command. Note that &lt;strong&gt;it doesn't stage new or untracked files.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Merge changes
&lt;/h3&gt;

&lt;p&gt;We can now merge the new feature into the main branch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout main
git merge greeting-feature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We see the following output, informing us that a fast-forward merge was performed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fast-forward
 hello.py | 3 +++
 1 file changed, 3 insertions(+)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can now safely delete the &lt;code&gt;greeting-feature&lt;/code&gt; branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-d&lt;/span&gt; greeting-feature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we've covered the essential local commands of Git, giving you a solid foundation to start using version control in your development workflow. We learned how to create a repository, track changes using staging, commit changes with informative messages, and manage branches using git branch and git checkout.&lt;/p&gt;

&lt;p&gt;We also explored the powerful git merge command, which allows you to bring changes from different branches into the main codebase, and we saw how to handle both fast-forward merges and merges with conflicts.&lt;/p&gt;

&lt;p&gt;By now, you should feel more confident in managing your code with Git and using branches to work on separate features. Congratulations on mastering the basics!&lt;/p&gt;

&lt;p&gt;I hope you found this tutorial helpful, and I apologize for its length. I understand that it might have been quite detailed, but I believe that the in-depth explanations will benefit your understanding of Git. Your time and attention are greatly appreciated.&lt;/p&gt;

&lt;p&gt;In the next tutorial, we'll take it a step further and explore the world of remote repositories. We'll show you how to collaborate with others, share your code on platforms like GitHub, and use Git's remote commands to work with repositories hosted on remote servers. Stay tuned for an exciting journey into the world of remote Git!&lt;/p&gt;

&lt;p&gt;Feel free to leave your feedback or any questions in the comments below. Happy coding!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Git: The Basics</title>
      <dc:creator>Fatema Moharam</dc:creator>
      <pubDate>Fri, 28 Jul 2023 18:51:38 +0000</pubDate>
      <link>https://dev.to/moharamfatema/git-the-basics-akc</link>
      <guid>https://dev.to/moharamfatema/git-the-basics-akc</guid>
      <description>&lt;p&gt;In the world of software development, version control systems are an indispensable tool for managing code changes, collaborating with others, and keeping track of project history. In &lt;a href="https://wizardingweb.hashnode.dev/can-someone-tell-me-what-a-repo-is"&gt;the previous post of this series&lt;/a&gt;, we discussed the importance of version control systems, and their types, and introduced some essential terminologies. In this post, we will focus on one of the most popular version control systems, Git, and its basics. Understanding the fundamentals of Git can help you streamline your workflow, avoid common pitfalls, and collaborate more efficiently with your team. So, let's dive in!&lt;/p&gt;

&lt;h2&gt;
  
  
  About Git
&lt;/h2&gt;

&lt;p&gt;Git is a distributed version control system that was created by &lt;em&gt;Linus Torvalds&lt;/em&gt; in 2005. It's incredibly popular due to its flexibility, speed, and ability to handle large codebases. With Git, developers can work on the same codebase simultaneously, and easily switch between branches to work on different features or fixes. Git also provides a wide range of tools to help with collaboration, such as merge requests and pull requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Snapshots, Not Differences
&lt;/h3&gt;

&lt;p&gt;Git is different from other VCS because it thinks of its data like a series of snapshots of a miniature filesystem rather than a list of file-based changes. Git stores data as snapshots of the project over time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Nearly Every Operation Is Local
&lt;/h3&gt;

&lt;p&gt;In Git, nearly every operation is local because most operations only require local files and resources to operate. This means that it is very little you cannot do if you are offline.&lt;/p&gt;

&lt;h3&gt;
  
  
  Git has Integrity
&lt;/h3&gt;

&lt;p&gt;Git has integrity because everything in Git is checksummed before it is stored and is then referred to by that checksum. Git uses &lt;a href="https://en.wikipedia.org/wiki/SHA-1"&gt;SHA-1 hash&lt;/a&gt; to store everything in its database not by file name but by the hash value of its contents.&lt;/p&gt;

&lt;h3&gt;
  
  
  Git Generally Only Adds Data
&lt;/h3&gt;

&lt;p&gt;When you do actions in Git, nearly all of them only &lt;strong&gt;&lt;em&gt;add&lt;/em&gt;&lt;/strong&gt; data to the Git database. It is hard to get the system to do anything that is not undoable or to make it erase data in any way. After you commit a snapshot into Git, it is very difficult to lose, especially if you regularly push your database to another repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Three States
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G_fxc5y5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkwcojwi2nsqbtu2goh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G_fxc5y5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkwcojwi2nsqbtu2goh5.png" alt="Working tree, staging area, and Git directory" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Modified means that you have changed the file but have not committed it to your database yet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Staged means that you have marked a modified file in its current version to go into your next commit snapshot.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Committed means that the data is stored in your local database.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In simple terms, Git has three main parts: the working tree, the staging area, and the Git directory.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The working tree&lt;/strong&gt; is the current version of the project that you are working on. It contains all the files you need to use or modify.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The staging area&lt;/strong&gt; is a file that contains information about what changes you want to include in your next commit. You can selectively stage changes, which means you can choose which changes you want to commit and which ones you don't.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Git directory&lt;/strong&gt; is where Git stores all the information about your project, including the history of changes and the current state of the project. When you clone a &lt;em&gt;repository&lt;/em&gt; from another computer, you are copying the &lt;em&gt;Git directory&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The basic Git workflow&lt;/strong&gt; involves making changes to your working tree, selectively staging the changes you want to include in your next commit, and then committing those changes to the Git directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;Enough with the boring stuff! Now that we've covered the basics of Git, it's time to take the next step and start using Git.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Git
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Linux
&lt;/h4&gt;

&lt;p&gt;The easiest way to install Git on your system is through the command line. Let's open a terminal. If you are working on Ubuntu or Debian, all you need to do is run the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Ubuntu, this PPA provides the latest stable upstream 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;add-apt-repository ppa:git-core/ppa
apt update
apt &lt;span class="nb"&gt;install &lt;/span&gt;git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are using a different Linux distro, you can find instructions on the &lt;a href="https://git-scm.com/download/linux"&gt;Official Downloads Page&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Windows
&lt;/h4&gt;

&lt;p&gt;To install git on windows, all you need to do is follow these steps.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to the Git website at &lt;a href="https://git-scm.com/download/win"&gt;&lt;strong&gt;https://git-scm.com/download/win&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click the download button for the 64-bit Git for Windows Setup&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the download is complete, double-click on the downloaded file to start the installation process&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the desired language for the installer and click 'OK'&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow the on-screen instructions to complete the installation&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To verify the installation, you can do any of the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to any folder or the desktop and right-click, if you see "&lt;strong&gt;Git Bash Here&lt;/strong&gt;", then you successfully installed Git on your machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open a &lt;em&gt;Command Line&lt;/em&gt; or &lt;em&gt;Powershell&lt;/em&gt;, and type:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you see something like this: &lt;code&gt;git version&lt;/code&gt; &lt;a href="http://2.39.1.windows"&gt;&lt;code&gt;2.39.1.windows&lt;/code&gt;&lt;/a&gt;&lt;code&gt;.1&lt;/code&gt;, then you successfully installed Git on your machine.&lt;/p&gt;

&lt;h4&gt;
  
  
  Mac OS
&lt;/h4&gt;

&lt;p&gt;There are several ways to install Git on a Mac. The easiest is probably to install the Xcode Command Line Tools. On Mavericks (10.9) or above you can do this simply by trying to run &lt;code&gt;git&lt;/code&gt; from the Terminal the very first time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you don’t have it installed already, it will prompt you to install it.&lt;/p&gt;

&lt;p&gt;Or you can follow the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to the Git website at &lt;a href="https://git-scm.com/download/mac"&gt;&lt;strong&gt;https://git-scm.com/download/mac&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click the download button for the macOS installer&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the download is complete, double-click on the downloaded file to start the installation process&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow the on-screen instructions to complete the installation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open the Terminal app and type &lt;code&gt;git --version&lt;/code&gt; in the terminal window and press enter to verify that Git is installed correctly. If you see the Git version information, it means Git has been successfully installed.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it! You now have Git installed on your machine and you're ready to start using it.&lt;/p&gt;

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

&lt;p&gt;In this post, We've explained what Git is, how it works, and its advantages. We've also explored the three main states your files can reside in and provided installation guides for Linux, Windows, and macOS. I hope this post has been helpful to you, and I welcome your feedback in the comments. In the next post, we will dive deeper into Git's basic commands and help you create your first repository. So, stay tuned!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/book/en/v2"&gt;The Pro Git Book&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>git</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Can Someone Tell Me What a Repo Is?</title>
      <dc:creator>Fatema Moharam</dc:creator>
      <pubDate>Fri, 17 Feb 2023 14:25:19 +0000</pubDate>
      <link>https://dev.to/moharamfatema/can-someone-tell-me-what-a-repo-is-43al</link>
      <guid>https://dev.to/moharamfatema/can-someone-tell-me-what-a-repo-is-43al</guid>
      <description>&lt;p&gt;As a software developer, you know how frustrating it can be to manage changes to your code when working on a project with others. That's where version control comes in - it's a lifesaver! Version control is a powerful tool that tracks changes made to files over time, allowing you to easily revert to previous versions if something goes wrong. And the best part? You can work on the same project with other developers without any pesky conflicts. Version Control can help you improve your workflow and become a more efficient and effective coder.&lt;/p&gt;

&lt;p&gt;In this blog post, we'll cover everything you need to know to get started with version control. We'll cover the different types of version control, how they work, and why you should use version control.&lt;/p&gt;

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

&lt;p&gt;Version control systems are software tools that help track changes made in code over time. As a developer edits code, the version control system takes a snapshot of the files. It then saves that snapshot permanently so it can be recalled later if needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use Version Control?
&lt;/h2&gt;

&lt;p&gt;As a developer, you may face many challenges that can take up a lot of your time. Some of these challenges include fixing bugs, figuring out how to use new tools, or adding new features or content to your project. As your project becomes more complex, version control helps teams focus on what matters - delivering high-quality software on time. Here are some situations where version control can save you:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Collaborating with others: Version control makes it easier to collaborate on code with other developers. You can work on the same codebase without worrying about interfering with each other's changes. With version control, you can also easily see who made what changes and when.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Easy Undo: Remember that time when you deleted a whole folder of code? Yeah, we don't want to talk about it. With version control, you can easily undo changes and go back to a previous version of your code. It's like a time machine, but for your code!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Track Changes: You're trying to figure out why your code isn't working, and you realize that it's been changed. But by whom? And when? With version control, you can track all changes made to your code, and by whom. make it easy to visualize the changes and understand the development history of your codebase. This allows you to easily track down the culprit of any issues, and roll back to a previous version if necessary.&lt;/p&gt;

&lt;p&gt;Commit graphs are a visual representation of the history of changes made to your code, and they show the relationships between different versions of your code. They can be very useful for understanding the evolution of your codebase over time, and for troubleshooting issues that may have been introduced in a recent change. With a commit graph, you can see which versions of the code are related, who made changes to the code, and when those changes were made. This helps you quickly pinpoint when and where problems were introduced, so you can address them more efficiently. Some popular tools for viewing commit graphs in Git include &lt;a href="https://www.gitkraken.com/gitlens" rel="noopener noreferrer"&gt;GitLens&lt;/a&gt; and &lt;a href="http://git-cola.github.io/index.html" rel="noopener noreferrer"&gt;Git Cola&lt;/a&gt;. Here's a commit graph example from GitLens.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmtcu9zudy0omwxotgua4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmtcu9zudy0omwxotgua4.png" alt="Commit graph example" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Experimentation: Version control makes it easy to experiment with new features and changes. You can create a branch for your experiment, make changes, and easily switch back to your main branch if things don't work out.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backups: You're about to turn in your project, but your computer crashes. Panic sets in as you realize you forgot to save the latest version. But don't worry! With version control, you always have a backup of your code, so you can retrieve it even if your computer decides to take a nap.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Types of Version Control
&lt;/h2&gt;

&lt;p&gt;Before we dive into the types of version control, let's first take a moment to explain some important terms.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Repository&lt;/strong&gt;: A repository, or "repo" for short, is a directory or folder where your project's files and code are stored. It's a centralized location where all changes and versions of your project can be tracked, managed, and stored. You can think of it as a digital filing cabinet that holds all of your project's documents, images, and code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Remote repository&lt;/strong&gt;: A remote repository is a repository that is hosted on a remote server or online platform, such as &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;, &lt;a href="https://bitbucket.org" rel="noopener noreferrer"&gt;Bitbucket&lt;/a&gt;, or &lt;a href="https://gitlab.com/" rel="noopener noreferrer"&gt;GitLab&lt;/a&gt;. It's a place where you can store your code in the cloud, and collaborate with other developers on the same project. This allows multiple developers to work on the same codebase and share changes with each other in real time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Local repository&lt;/strong&gt;: A local repository is a repository that is stored on your own computer. It's a copy of the remote repository, which you can edit and make changes to without affecting the remote version. This allows you to work on your project even if you don't have an internet connection, and make changes to your code and files at your own pace. Once you're ready to share your changes with others, you can push your changes to the remote repository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Codebase:&lt;/strong&gt; The term "codebase" refers to the entire collection of source code files for a particular software project. It includes all the code that is written for the project, including any libraries or third-party dependencies that the project relies on.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are three types of version control systems: &lt;strong&gt;local, centralized, and distributed.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local&lt;/strong&gt; version control is the simplest type, where changes to files are tracked on the developer's &lt;em&gt;local machine&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Centralized&lt;/strong&gt; version control systems are designed for teams to collaborate on &lt;em&gt;a shared repository&lt;/em&gt;. Changes are tracked and stored on a central server, allowing team members to access the most up-to-date version of the code. Examples of centralized version control systems include &lt;a href="https://subversion.apache.org" rel="noopener noreferrer"&gt;&lt;strong&gt;Apache Subversion (SVN)&lt;/strong&gt;&lt;/a&gt; and &lt;a href="https://azure.microsoft.com/en-us/products/devops/server" rel="noopener noreferrer"&gt;&lt;strong&gt;Azure DevOps Server&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Distributed&lt;/strong&gt; version control is similar to centralized version control, but each developer has &lt;em&gt;a complete copy of the repository on their local machine&lt;/em&gt;. Changes are tracked and can be shared among team members, allowing for more flexible collaboration. &lt;a href="https://git-scm.com/" rel="noopener noreferrer"&gt;Git&lt;/a&gt; is an example of a distributed version control system that has become extremely popular in recent years due to its speed, flexibility, and powerful branching and merging capabilities.&lt;/p&gt;

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

&lt;p&gt;In conclusion, version control is a powerful tool that software developers can use to track changes made to code over time, collaborate with others, and easily revert to previous versions if something goes wrong. There are three types of version control: local, centralized, and distributed, with Git being a popular choice for distributed version control. By using version control, developers can focus on delivering high-quality software on time, experimenting with new features and changes, tracking changes, and allows them to have backups of their code, easily accessible at any time.&lt;/p&gt;

&lt;p&gt;In the next post of this series, we'll dive into the most popular version control system, Git, and how it can be used to improve collaboration and productivity. Stay tuned for more!&lt;/p&gt;

</description>
      <category>support</category>
      <category>security</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
