Introduction to Git and Git commands
Software Engineer @mindfires
Working
Directory
Staging
Area
Local Repo
(HEAD)
Remote Repo
(MASTER)
Git Add
Git Commit
Git Push
Git Fetch
Git Merge
Git Pull
Current State of the repository
git log
commit 6aa24bb96658ce2541f69f9eccfc3d65826c726b
Author: Sanjeev Yadav<sanjeev@gmail.com>
Date: Mon Apr 22 22:39:20 2019 -0300
Added a line
commit c861cb6c8d0f3c78b24004cfe23df55934cd3ca4
Author: Robin Thicc <thicc@gmail.com>
Date: Mon Apr 8 18:20:20 2019 -0300
Created file
git remote add myrepo
https://github.com/user/repo.git
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int e = 5;
git push
int a = 1;
int b = 2;
int c = 3;
int d = 4;
add line
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int e = 5;
server
local
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int e = 5;
git pull
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int e = 5;
server
local
int a = 1;
int c = 3;
int d = 4;
int e = 5;
int a = 1;
int c = 3;
int d = 4;
int e = 5;
int a = 1;
int b = 2;
int c = 3;
int d = 4;
git clone <url>
int a = 1;
int b = 2;
int c = 3;
int d = 4;
git reset --hard
edfe30cc
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int e = 5;
add line edfe30cc
int b = 2;
int c = 3;
int d = 4;
int e = 5;
remove line 51ej004
int a = 1;
int b = 2;
int a = 1;
int b = 2;
int c = 3;
int a = 1;
int c = 3;
int a = 1;
int c = 3;
int d = 4;
master branch
int a = 1;
int b = 2;
int a = 1;
int b = 2;
int c = 3;
int b = 2;
int c = 3;
int d = 4;
int a = 1;
int b = 2;
int c = 3;
int d = 4;
master branch
int a = 1;
int b = 2;
int c = 3;
String sanjeev = "handsome";
int a = 1;
int b = 2;
int c = 3;
// No you are not :(
feature branch
bugfix branch
git branch
feature
int a = 1;
int b = 2;
int c = 3;
int a = 1;
int b = 2;
int c = 3;
int d = 4;
master branch
int a = 1;
int b = 2;
int c = 3;
int d = 4;
feature branch
int b = 2;
int b = 2;
int c = 3;
int b = 2;
int c = 3;
int d = 4;
int a = 1;
int b = 2;
int c = 3;
int a = 1;
int b = 2;
int c = 3;
int d = 4;
master branch
feature branch
git pull
int a = 1;
<<<<<<< HEAD
int b = 2;
=======
int b = 0;
>>>>>>> c861cb6c8d0f3c78b2
int c = 3;
int d = 4;
int e = 5;
{
your changes
{
remote changes
conflicting commit
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int e = 5;