An Introduction to Git - Basic Understanding and Commands

An Introduction to Git - Basic Understanding and Commands

Git - Overview

c4t7mhrhfto7hbs39qz0.png We often hear the statement whenever we ask about git which is "Git is a distributed version control system". But what does it really mean??

A version control system is basically a system that provides with you the features of keeping a record of your software code changes, who made those changes, and at what time. Even restoration of previously changed code is possible with git. Git is a DevOps tool used for source code management. It is a free and open-source version control system used to handle small to very large projects efficiently.

Some advantages to developers after git:-

  • Every developer has an entire copy of the code on their local systems

  • There is regular communication between the developers

  • Any changes made to the source code can be tracked by others

Features of Git

  • Distributed System
  • Compatible with all the Operating Systems
  • Branching
  • Speed
  • Open Source
  • Secure

Git Workflow and Fundamentals

128hsgntnsu9bww0y8sz.jfif

The Git workflow is divided into three states:

  • Working directory - Modify files in your working directory

  • Staging area (Index) - Stage the files and add snapshots of them to your staging area

  • Git directory (Repository) - Perform a commit that stores the snapshots permanently to your Git directory. Check out any existing version, make changes, stage them and commit.

Branch in Git

Branch in Git is used to keep your changes until they are ready. You can do your work on a branch while the main branch (master) remains stable. After you are done with your work, you can merge it with the main office.

small-feature.jfif

Commands in Git

Create Repository

  • git init

    Make Changes

  • add
  • commit
  • status

    Parallel Development

  • branch
  • merge
  • rebase

    Sync Repositories

  • push
  • pull
  • add origin

Hope you would have got the basic of Git in this blog.

Check out the other blog in which I have provided the basic explanation of Github and its uses.