Getting Started With Git

1 minute read

Getting Started with the GIT Version Control System

What is Git?



  1. Debian
    sudo apt-get install git -y
  2. Redhat
    sudo rpm install git -y
  3. Using the yum package manager
    sudo yum install git -y


brew install git

Basic commands

Basic Configuration

git config <>
git config "Your Name"
Or Edit the ~/.gitconfig file on unix-based platforms
name = Your Name
email = <>
editor = vim
pager = less -S

ui = true
diff = auto
status = auto
grep = auto
interactive = auto

tool = vimdiff
ci = commit
lg = log --all --abbrev-commit --decorate --graph --oneline
st = status
co = checkout
mt = mergetool

helper = cache

autocorrect = 10

Creating a new repository

mkdir new_repo
cd new_repo
git init .
git remote add origin <>


git add . # Add all files in source tree
git commit # Add files to git
git commit -m "Commit Message" # without opening your editor

Commit History

git log --all --abbrev-commit --decorate --graph --oneline


git checkout -b new_branch # Create and switch to new branch
git checkout master  # Go to branch named master
git checkout commithash  # Checkout the state of the repository as at the commit