Git for Beginners: Basics and Essential Commands

When we start learning development(coding), we often hear words like Git, GitHub, version control system, commit and repository.
At first, Git feels confusing, especially when commands are involved. But the truth is, Git is not difficult — it just needs a simple explanation.
In this blog, we will learn what Git is, why it is used, and the most important Git commands every beginner should know.
What is Git?
Git is a version control system and it save our changes(what we have done and want to save it), It save our changes in versions like version: 1.0 > 1.1 > 1.2, so on. It helps to track our changes(what we had saved) or history of our code so we can go back anytime if something breaks.
Why Git is Used?
Git is used because we need to track our changes, history, logs, revert changes and many more.
Git Basics and Core Terminologies.
Git and GitHub core concepts are like repository, commit, branch and head
Repository: A repository is a place where our project and its full history are saved.
Commit: A commit is a recorded snapshot of project changes saved in the Git repository along with a commit message.
branch: A branch lets you work on new features or fixes without affecting the main code.(Ek tree ki multiple daliya jo bilkul alag hote hain ped ke dursre daliyo se).
head: It is a pointer that indicates the currently checked-out branch and its latest commit.
Is Git and GitHub same?
No, let understand with example.
Git is like a camera that takes snapshots(capture) at the moment whenever we want to takes it.
And GitHub is a Storage like Google Drive where you store those snapshots online.
Now, I hope you understand about the git in simple word.
let see some of the important commands should know everyone who want to start development.
First of all download git from its official website(https://git-scm.com) and install according to your operating system.
After installing Git, open your terminal or command prompt and type:
git --version
If version appears → Congratulations you have installed Git.
Now you have do to following things:
Write your code.
Add your files.
Commit your changes.
In above lines we are doing just few things.
Working Directory → Staging Area → Repository
Now comes to essential commands(Common Git Commands).
git init : Initializes a Git repository.
git status : Shows current file status.
git add <filename> : Adds specified files to staging area.
git add . : Add all files to staging area.
git commit -m "commit message" : Saves your changes(snapshot of code).
git log : Shows commit history.
Now we will talk about “Few Common Mistakes” usually we do.
Writing bad commit messages: During commit our changes we pass insufficient commit message or
Confusing Git with GitHub: We always thing both are same but not at all as we had discussed above.
Fear of terminal: I don’t know why we think is Terminal is another world and if we go in that world we lost something.
So Git is an essential tool for every developer. Once you understand the basic workflow and commands, Git becomes very easy to use.
If you found this helpful, follow me for more beginner-friendly development related tutorials.
It would love to get feedback or suggestions.
About the author
I am a Front-end Developer with 7 years of experience, started from HTML, CSS and JavaScript then switched into any UI Development again switched into React Development. Now Looking for anything like in language and started digging into that slowly.




