Skip to main content

Command Palette

Search for a command to run...

Understand Git as Distributed Version Control System.

Published
•2 min read•View as Markdown

What is git and How it's work:

'Git' is a Distributed Version Control System, it track the changes of file. Distributed, it allow multiple people to work on the same project.

Three main components (stages) of git:

Git track out changes across the three stages in our local system.

Working directory (work space): This is when you add, remove, or change something in a file. Git has noticed the change but you have not formerly informed Git of the change yet. Changes are untracked until submit or index.

Ex Command: git status (for knowing status whether installed or not) // git init (initialize directory) 2. Staging area (index):When we made changes in file, tell to git to take note of that change. Commonly known as the "Staging Area", files in this stage are called the Staged Files. You can modify a file even after staging it, which lets you see the file both in a modified state and a staged state. The modifications made after the staging will not appear after a commit has been made.Ex Command : git add index.js // git add . ('index.js' single file which we are added(staged) // '.' represent all files were stagged respective directory) 3. Commit State:

In this state Git has saved your modified changes. After staging (add) only we can commit or save.

Ex Command: git commit -m"This fist commit" // git commit -am"Thsi is commit" (commit with include add)

Basic Commands:

Initialize: git init

To know the status: get status

Remove file: rm -rf .git

list out file in directory: ls (or) ls -a

Staging(adding): git add hello.js

Commit: git commit -m"This is the base file" (or) gir commit -am"This is index file" (commit with add)

Log information: git log // git log --online

Revert: git revert