Git Commands | Training | Basics | Videos | Tutorials

Introduction to Git & Git Commands


What is Git?

  • Keeps track of changes (text especially)
  • Version control system (VCS)
  • Source Code Management (SCM)

Git is distributed version control system:

  • Different users maintain their own repository instead of working from central repository
  • Track changes not version (change sets or patches)
  • Change sets can be exchanged between repositories ( merge changes or apply patches)
  • No need to communicate with central server when working on a local copy (no network access is required).

Installing git Windows/Mac/Linux

Git configuration

Git can be configured at three levels:

  1. system
  2. user
  3. project

1. System

Program Files\Git\etc\gitconfig

git config --system

2. User


git config --global
manvirbasra->$git config --global "Manvir Basra"
manvirbasra->$git config --global ""
manvirbasra->$git config --list Basra
manvirbasra->$cd ~
manvirbasra->$cat .gitconfig
	name = Manvir Basra
	email =

3. Project


git config

Git Three Tier Architecture

git three tier architecture

Git Help Commands

manvirbasra->$git help
manvirbasra->$git help log
:f - forward
:b - backward
:q - quit

Initializing a git repo

  • This command creates a .git folder inside the current directory which contains all the tracking information.
manvirbasra->$git init
  • To add everything in the working directory to staging
git add .
  • To commit
git commit -m "commit message"
  • Git Logs
git log --grep="bug fix"
git log -n 2
git log --since=2014-08-02
git log --until=2014-08-02
git log --author="Manvir"
  • HEAD

To show current brach’s head pointing to:

git log HEAD or
cat HEAD
  • To Check Git Status

status between repository, staging directory and working directory

$git status


Leave a Reply

Your email address will not be published. Required fields are marked *