Your First Steps in Git: Essential Commands
A quick way to learn the core commands to start tracking, commiting and managing your code.

What is GIT?
Git is a tool that helps you manage changes to your code over time. It notes every changes or updates you make. It also has the liability to undo mistakes or look back to previous version if needed. So in simple term, ‘Git can be referred to as a camera that takes snapshot of your work. Everything you do like edit, updates or tiny changes is captured and stored safely inside hidden .git folder’.
What is the purpose of using Git?
Generally git is used for its powerful, flexible and user friendly features, allows for team collaboration, manages changes to your code in a safe and easy way. Not only this but also features like code merge, detect conflict, parallel programming and many more.
Some Basics and Core Terminologies
Repository(Repo)
A storage space which contain all project files and their revision history. Here the storage space can be local or remote according to requirement.
To initialize a git repo:
git init
Working Directory
Local folder where you can update or edit files.
When you are working on your project folder like modifying, you are working in the working directory.
git init
git revert
Staging Area
It is a temporary place where the changes are stored before committing to the .git folder
git add . //Add the main file and correspondence/sub files within it
git add filename.txt //add only the named file
Commit
It captures the changes that have been staged at that moment, which is generally referred as snapshot of the staged content and has a hash id for each commit.
git commit -m "referrence for what action been performed"
git commit -am "ref." //here is perform the action for git add and git commit altogether.
Branch
This helps in managing the workflow by allowing parallel workflow, where the main branch holds the main-project whereas the sub branches carryout the experimental features, bug, etc.
git branch <branch-name> //to create a new branch
git chechout -b <branch-name> //to switch to particular branch
Merge
Generally combine changes from one branch to another.
git merge <branch-name> //merge the content from the sub branch to the main branch
Push
Uploading of the content of the .git folder which is local to online server(remote).
git push <remote> <branch>
Pull
To fetch and merge remote changes to the local system.
git pull <remote> <branch>
Remote
It is a reference to the repository which is remotely present / online.
Common Git Commands
git add -move to staging area
git commit -save changes(move the snapshot to .git folder)
git log -view commit history
git status - provides a real-time summary of your git repo.
git branch -display and manage branch

