jubayer-hossain
8/3/2018 - 6:08 AM

Useful Git Commands

Useful Git Commands

First of all install git on ubunut

sudo apt-get install git 

Check git version

gti --version

Project Initialize

git init

Check status

git status 

Add single file

git add <filename>

Track all files

git add .(dot)

Git config

git config --global user.email "example@gmail.com"
git config --global user.name "username"

Commit files

git add -m "message"

Check commit

git log

Show commit message and id in Oneline

git log --oneline

Check commit id

git show <commit id>

Git diff

git diff

Difference between two files

git diff --staged

Difference between two commits

git diff <commit id one> <commit id two>

Remove files

git rm <filename>

Git Reset

gti reset HEAD <filename>