SAGARFIVE

1. Introduction

2. Git Basics

3.  Git Terminology

4.  Git Branching

5.  Git - Github

6.  Git Add (Git staging)

7.  Git Commit

8.  Github Advanced

9.  Git Remote

6.6 Git diff

  • It is used to show changes between commits, commit, and working tree, etc.
  • Mostly helpful when merge conflict to identify changes made by commits

1Track the changes of two commitsgit diff <commit1-sha> <commit2-sha>
2Track the changes of two branches git diff <branch 1> < branch 2>  
3Track the changes of latest commit
(* Not confirmed)
git diff HEAD
4Track the changes of staged filesgit diff –staged  
5Track the changes of unstaged files
(* Not confirmed)
git diff
4Track the changes made of a single filegit log -p –follow — filename  

(i) Checking the diff of two commits :

git diff <commit1-sha> <commit2-sha>

(ii) Track the changes of two branches  :

git diff <branch-1> <branch-2>

(iii) Checking the diff of staged files :

git diff –staged