Git for beginner
This blog will demonstrate the you the git in the simple and more concise way. this blog contain what is git, why git, core concept of the git, command for beginner, git work flow and example on the git.
What is Git ?
Git is an open source platform used to track the changes in the codebase. Git is a versions control system. It was developed by the great and my idol Linus Torvalds in 2005. He develop this project just to track the changes on his Linux kernel project.
Why Git is used ?
Git is used to version control system (VCS) of the software. where developer collaborate with other developer and contribute there changes in the software developing project. Git also track the changes in the codebase.
Git Core Concept :-
-Repository
Repository is like the database which contain all the file and folder along with the .git folder usually this folder is hidden but present along with your codebase.
-Commit
a commit is a snapshot of the project at a specific time. Every commit contain a unique hash value and point to it previous commit.
in simple example think it like save point or checkpoint for video game.
-Branch
A branch is just a pointer to the commit. in Git, main (Master branch in the early days) is the main branch. Develop can create there own branch and work on it and push the changes to the main branch.
-Head
Head is like a check mark which tells where you are. On which branch you are and your current changes
Git Commands and terminology
Git Commands:-
git init :- it is used to initialized the codebase as a git project. means after writing this command the git is track the changes in the codebase and the now on the developer can collaborate.
git log :- this command give all the history of the commit history of the codebase in the chronological order
git status :- Display the current state of the working directory and staging area.
git add <file/folder> :- this command stage the all the file and folder in the staging area. where all the change code is add and stage in the staging area.
git commit :- Git most famous command. creating a snapshot of the project at a specific point in time. Core Git function used to save changes from the staging area into the repository’s history.
there are many more command like git push, git pull, git fetch and merge and soon. Some of the terminology like branch, upstream, remote, etc…
Git Workflow

This diagram the is main nutshell of the git workflow. Trust me if you understand this diagram you understand the workflow
it start with the working directory after we make the changes in the codebase. the .git folder track all the change in the current working directory.
Once we done with all the changes we use git add <file name/ folder name> or simply we can use git add . the .(dot) is used to add all the changes, untracked and modify file and folder. After adding all the file it goes to staging area. git staging area is an intermediate layer between the working directory and the Git repository
A Git local repository is a repository hosted on a local machine for an individual user, containing a complete history of the project and all its versions, including commits, branches, and merges.
A Git remote repository is a version of a project hosted on a network or the internet, allowing collaboration by enabling push and pull operations between local and remote copies.






