Git Quick Start

In this post we will learn basic commands to get started with git and github

Install Git on Linux

$sudo apt install git-all

Initilize directory as git directory

$git init

Initilize the configurations

$ git config --global "Your Name "
$ git config --global

Clonning the github repo

$git clone /path/to/repository

Add files to git

$git add <filename>
$git add *

Commit the Changes

$git commit -m "Commit message"

Push changes to git server

$git push origin master

Add Origin master if not added

$git remote add origin <server>


Create a branch
$git checkout -b feature_x

Switch back to master branch
$git checkout master

Delete the branch again
$git branch -d feature_x

Push the branch on the server
$git push origin <branch>

Update Local repository

$ git pull

Merge another branch into your active branch (e.g. master), use
$git merge <branch>

Reference :