git — beginners guide

  1. Check git version
$ git --version
$ git config --global user.name "Himanshu Pratap"
$ git config --global user.email himanshupratap@gmail.com
$ git config --list
$ git config --global core.editor "code --wait"
$ mkdir git_test
$ cd git_test
$ git init
$ git status
$ git add .
$ git commit -m "first commit"
$ git log --oneline
$ git log
$git checkout <commit> <file>
$ git remote add origin <repository url>
$ git push -u origin master
$ git clone <repository url>
$ git reset --hard <SOME-COMMIT> t
git fetch --all
git reset --hard origin/master

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Himanshu Pratap

Himanshu Pratap

System Administrator and Full stack web developer.