Git for Beginners: Basics and Essential Commands

What is Git?
Git is the open source distributed version control system .version control system is the software which tracks the changes to code in file over time .version control system is of two types :
- centralized version control system (cvcs):
In the centralized version control system , there is a single server where every member of the team synchronize with the server to get updated code , if any member of the team changes the code or add feature then it has to be updated in server so that other member can synchronize with it.If the central server goes offline then no one can synchronize with central server . it is good for small team but not ideal for the large.
note: synchronize means the codes of all member of the team should be same

- ** distributed version control system:**
In the distributed version control system ,every member has the local copy of the remote repository , if anyone want to makes changes or add new feature then they do in the local repository , then it has to be pushed in the remote repository so that other member can pull the updated code and synchronize with other.so there no dependency of sigle server

note:repository means the storage where all your project files, code and tracking history file.the local repository is stored on local computer while remote repository is store on cloud based server.
the git solves the problem of the tracking of the changes in the codes.git was created by the Linus Torvalds in April 7, 2005..the difference between the git and github is that the git track the changes in the code in project file while github is use to host the git due to which collabration and synchronize was possible.who should learn git in this 21st centuary .the answer anyone who is working with digital files especially in the collaborative environment should learn git
Why git
we need to understand the problems people faced before Git .They are
- **Complete project history of channges: ** without git, its was very hard to track the changes in the code , you could not easily see what as added , what was removed , when it changed. if this is difficulty for one person ,it becomes much more frustating ehrn many people are working on same project
Git Core Terminologies

Repository (Repo):storage area where the project file and git file
Working Directory: the folder in your computer where you work on the project
Staging Area (Index):It is the temporary storage area before saving in the local repositories.
Commit:it saves the changes from staging area to the local repositories
Branch:its is the workspace where you make some changes and try new idea without affecting the project

Merge:it is used to merge one or more branch into another
Clone: it is process of creating the duplicate copy from the remote orginal project
Pull:it is used fetch the remote repository , if there is changes then it is used to integrate into the loal repository.
Push:integrating the changes done into local repository into the remote repository.
Remote:Remote is also called as the remote reposotory.which means which is hosted on the internet.
HEAD:It the address pointer which store address of the current commit.
Status:It display the current status of the working directory and the staging area.
Log: it display the all list of commit in the repository.
.gitignore:it is the special file in the git which tells the system which file or folder to ignore while commiting
Checkout:it is used to create new branch and switch between the branches
common git command
git init
git log
git add <file>
git status
git commit -m ‘message‘
git clone <url>
git checkout <branch name>




