Git for Beginners: Basics and Essential Commands

Introduction
Git is a code tracker that is installed on your machine (computer/laptop). Git helps you write code fearlessly and tension-free. where you can track changes, and you can undo your code with the help of git. You can do any experiments with your code because you have undo power with git. Git allows you to work on a single project with multiple developers.
Git was introduced in 2005 by the legend Linus Torvalds. Linus invented git when he was working on linux operating system. Linus was very troubled to track his own code when he was very disponting other services and the make git for our comfort. Now Git is a very famous and life changing projcect for developers. Git was first released in April 2005, and the current version is 2.52.0.
Without Git and with Git.
Without git you need to always remember changes in your codes or you need to find your old zip file or code. Which very common headache situation during any project. Developers don’t want this unwanted headache.
With git you can go back and old version with sinlge git command, which is a lifesaver for developers. If 4 developers are working on a single project, you can track all the things with every developer. Git is a distributed system that means all the details of the project in evry single developer who is working on the system, which is a good thing.
Core Git Terminologies (Most Important)
Git is a tool that tracks your code/project history. Below are some git terminologies that work like.
1. Repository (Repo)
Your Projects folder's git tracking changes are called a Repo.
Exmaple:- “Asif Website” folder = repo
2. Version Control
It works exactly as it sounds. This is manage project with old and new versions.
3. Commit
Commit is a work save point and checkpoints. This means fixing one version of the code.
4. Branch
Make a copy of your main project so you can experiment with it without damaging the main code.
5. Merge
I am adding Changes from the branch to the project after complete work.
6. Working Directory
The area where you are currently editing the code.
7. Staging Area
The "ready area" before committing Where you decide which changes to save.
There are more, but I mentioned here only 7 because there are many things to tell but for biginner i thing this is enough.
Common Git Commands & Usage
| Command | Usage |
| git init | Git starts in a new project (Start Tracking) |
| git status | To check: what changes have been made, what’s in staging, and what commits are pending. |
| git add . | Send all changes in staging area. |
| git commit -m "msg" | Permanently save changes with a message. |
| git log | View the history (All previous commit lists). |
| git branch | View branch lists. |
| git diff | Compare the old and new changes. |
Final Conclusion: Git Makes Coding Safer, Faster & Organized 🚀
It keeps a record of all changes in the project, so if something goes wrong, we can go back to the old version quickly. Git also helps to improve the project step by step without losing important work.
It is also very useful for teamwork because many people can work on the same project in a better way and the chances of mistakes become less. Overall, Git makes coding more organized, safe, and fast, so it is an important skill for every beginner developer.




