DEV Community

Cover image for How GIT Works
Aadityasiva
Aadityasiva

Posted on

2 2

How GIT Works

In this post I will be covering how GIT works under the hood. So first lets take an example if you are making a project and you want to try some changes which is going to break the code and definitely you want to revert those changes so there are to ways to approach the problem one way is to just ctrl+z it but this solution is not good for many changed files and ctrl+z also has its limit. A good solution is to use GIT each GIT commit is a restore point and you can revert to that commit if you don't want to keep the changes but if you do want to keep the changes you made you can create a commit and GIT will keep all the changes you made and GIT will make you a restore point which can be used in the future.

What is a GIT repository

A GIT repository is a hidden folder which contains all the commits or I like to call them restore points that can be used to revert to that commit.

How GIT commit works

GIT commit has 3 stages they are :-

  1. Working directory :- The directory in which you will make changes.
  2. Staging area :- The directory in which you will select which files to keep and which files to discard.
  3. Repository :- The place where the commit is saved.

So I am ending this post here bye and have a nice day!
Any queries ask me in the discussions

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (1)

Collapse
 
programmeraadi profile image
hmmmmmmcoder •

Nice

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay