SlideShare une entreprise Scribd logo
1  sur  44
Presented By:
Md Swawibe Ul Alam
Junior Software Engineer
Nascenia Limited
Merge
Git Merge
 What it does?
Join two or more development histories/branches
together
Git merge is 2 types:
 Fast forward
 No fast forward
Example : Fast-Forward Git Merge
 Let us assume that I created a topic
branch named speedup from the
current master. After working on this
branch for a while (three commits,
those white circles),I finally decided
that I am done and then I pushed it to
my own remote. Meanwhile, nothing
else happened in the master branch.
 Now if we use git merge using git fast-
forward then my work is landed on
the source tree. Because master has
not been changed since the commit
(gray circle).whole series of the
commits will be linear.
Example : Fast-Forward Git Merge
Example : No Fast-Forward Git Merge
 If we use -no-ff option (it stands for no
fast-forward). In this case, the history
looks slightly different (right side),
there is an additional commit (dotted
circle) emphasizing the merge
Rebase
Git Revert
 This command creates a new commit that undoes
the changes from a previous commit. This command
adds new history to the project (it doesn't modify
existing history)
 Use this to rollback changes you have committed
Git checkout
 Use this to checkout a branch or specific commit
 This will rollback any changes you have in your
working copy
 This will NOT make any changes to the history
Git reset
 Use this to rollback changes made to the index (eg:
from git add), which will NOT change the history.
 Use this to change what commit a head is pointing
to, which will change the history
Cherry Pick
 What git cherry-pick does, basically, is take a
commit from somewhere else, and "play it back"
wherever you are right now. Because this introduces
the same change with a different parent, Git builds a
new commit with a different ID
Cherry Pick : Example
❖ If you were at node H in this graph, and you typed git Cherry-pick E you'd
wind up with a copy of commit E—let's call it "E prime" or E'—that
pointed to H as its parent
❖ if you typed something like git cherry-pick C D E
Advanced Git Log
Advanced git log can be divided into two parts :
Formating log output
Filtering log output
Formating log output
 Formatting shows how each commit is displayed. Available
formats are-
 Oneline
 Decorating
 Diffs
 Shortlog
 Graph
 Custom formatting
Oneline
 The --oneline flag condenses each commit to a single
line.
 $ git log --oneline
 output:
0e25143 Merge branch 'feature'
ad8621a Fix a bug in the feature
16b36c6 Add a new feature
23ad9ad Add the initial code base
Decorating
 The --decorate flag makes git log display all of the
references (e.g., branches, tags, etc) that point to
each commit.
 $ git log --oneline --decorate
 output:
0e25143 (HEAD, master) Merge branch 'feature'
ad8621a (feature) Fix a bug in the feature
16b36c6 Add a new feature
23ad9ad (tag: v0.9) Add the initial code base
Diffs
 The git log command includes many options for displaying diffs with each
commit. Two of the most common options are -
 --stat
 The --stat option displays the number of insertions and deletions to each file altered by
each commit
 $ git log --stat
 output:
 commit f2a238924e89ca1d4947662928218a06d39068c3
Author: John <john@example.com>
Date: Fri Jun 25 17:30:28 2014 -0500
Add a new feature
hello.py | 105 ++++++++++++++++++++++++-----------------
1 file changed, 67 insertion(+), 38 deletions(-)
Diffs cont..
 -p
 To see the actual changes introduced by each commit, pass the -p option
to git log
 $ git log --stat -p
 output:
 commit 16b36c697eb2d24302f89aa22d9170dfe609855b
Author: Mary <mary@example.com>
Date: Fri Jun 25 17:31:57 2014 -0500
Fix a bug in the feature
diff --git a/hello.py b/hello.py
index 18ca709..c673b40 100644
--- a/hello.py
+++ b/hello.py
@@ -13,14 +13,14 @@ B
-print("Hello, World!")
+print("Hello, Git!")
Shortlog
 The git shortlog command is a special version of git
log intended for creating release announcements.
 It groups each commit by author and displays the
first line of each commit message
Shortlog cont..
$ git shortlog
output:
Mary (2):
Fix a bug in the feature
Fix a serious security hole in our framework
John (3):
Add the initial code base
Add a new feature
Merge branch 'feature'
Graph
 The --graph option draws an ASCII graph
representing the branch structure of the commit
history
 This is commonly used in conjunction with the --
oneline and --decorate
Graph cont..
$ git log --graph --oneline --decorate
output:
* 0e25143 (HEAD, master) Merge branch 'feature'
|
| * 16b36c6 Fix a bug in the new feature
| * 23ad9ad Start a new feature
* | ad8621a Fix a critical security issue
|/
* 400e4b7 Fix typos in the documentation
* 160e224 Add the initial code base
Custom formatting
 For all of your other git log formatting needs the --
pretty=format:"<string>" option.
 Display each commit however we want using printf-
style placeholders
Custom formatting cont
$ git log --pretty=format:"%cn committed %h on %cd"
output:
John committed 400e4b7 on Fri Jun 24 12:30:04 2014 -0500
John committed 89ab2cf on Thu Jun 23 17:09:42 2014 -0500
Mary committed 180e223 on Wed Jun 22 17:21:19 2014 -0500
John committed f12ca28 on Wed Jun 22 13:50:31 2014 -0500
Filtering Log Output
 Filtering shows which commits are included in the
output. Following commands are used for filtering-
 By Amount
 $ git log -3
 By Date
 $ git log --after="2014-7-1"
 $ git log --after="yesterday"
 $ git log --after="2014-7-1" --before="2014-7-4"
Filtering Log Output Cont..
 By Author
 $ git log --author="John"
 $ git log --author="John|Mary" //(Mary or John)
 By Message
 $ git log --grep="JRA-224:"
 By File
 git log -- foo.py bar.py
 By Content
 git log -S"Hello, World!"
Filtering Log Output Cont..
 By Range
 $ git log master..feature
 $ git log <since>..<until>
 Filtering Merge Commits
 $ git log --no-merges
 $ git log --merges
Md Swawibe Ul Alam

Contenu connexe

Tendances

Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀
Wen-Tien Chang
 

Tendances (20)

git and github
git and githubgit and github
git and github
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
 
Introduction to Git (part 2)
Introduction to Git (part 2)Introduction to Git (part 2)
Introduction to Git (part 2)
 
Git commands
Git commandsGit commands
Git commands
 
Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
はじめてのGit forデザイナー&コーダー
はじめてのGit forデザイナー&コーダーはじめてのGit forデザイナー&コーダー
はじめてのGit forデザイナー&コーダー
 
Git basic
Git basicGit basic
Git basic
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
 

En vedette

Resume 2015.pptx may 28_2015 (1)
Resume 2015.pptx may 28_2015 (1)Resume 2015.pptx may 28_2015 (1)
Resume 2015.pptx may 28_2015 (1)
Melonie Bolton
 
MSDS Anhidrid ftalne kiseline
MSDS Anhidrid ftalne kiselineMSDS Anhidrid ftalne kiseline
MSDS Anhidrid ftalne kiseline
Marija Vukovic
 
Yirmed Demeke, ETHIOPIA, May 2015
Yirmed  Demeke, ETHIOPIA, May 2015Yirmed  Demeke, ETHIOPIA, May 2015
Yirmed Demeke, ETHIOPIA, May 2015
Yirmed Demeke
 
Fakultät Wirtschaftswissenschaften
Fakultät WirtschaftswissenschaftenFakultät Wirtschaftswissenschaften
Fakultät Wirtschaftswissenschaften
Ms. Qamar
 
ISO8583 MySQL UDF Manual
ISO8583 MySQL UDF ManualISO8583 MySQL UDF Manual
ISO8583 MySQL UDF Manual
sybond
 
Report on ISO8583,EDCPOS vs mPOS and EMV vs Magnetic Strip Cards
Report on ISO8583,EDCPOS vs mPOS and EMV vs Magnetic Strip CardsReport on ISO8583,EDCPOS vs mPOS and EMV vs Magnetic Strip Cards
Report on ISO8583,EDCPOS vs mPOS and EMV vs Magnetic Strip Cards
Darshana Senavirathna
 

En vedette (18)

STUDY ON ATM-POS SWITCHING SOFTWARE FOR BANKS
STUDY ON ATM-POS SWITCHING SOFTWARE FOR BANKSSTUDY ON ATM-POS SWITCHING SOFTWARE FOR BANKS
STUDY ON ATM-POS SWITCHING SOFTWARE FOR BANKS
 
Resume 2015.pptx may 28_2015 (1)
Resume 2015.pptx may 28_2015 (1)Resume 2015.pptx may 28_2015 (1)
Resume 2015.pptx may 28_2015 (1)
 
MSDS Anhidrid ftalne kiseline
MSDS Anhidrid ftalne kiselineMSDS Anhidrid ftalne kiseline
MSDS Anhidrid ftalne kiseline
 
12. Знешнепалітычная дзейнасць РБ
12. Знешнепалітычная дзейнасць РБ12. Знешнепалітычная дзейнасць РБ
12. Знешнепалітычная дзейнасць РБ
 
tirted.excited
tirted.excitedtirted.excited
tirted.excited
 
Yirmed Demeke, ETHIOPIA, May 2015
Yirmed  Demeke, ETHIOPIA, May 2015Yirmed  Demeke, ETHIOPIA, May 2015
Yirmed Demeke, ETHIOPIA, May 2015
 
Actividad 3 patricia sevillanos
Actividad 3 patricia sevillanosActividad 3 patricia sevillanos
Actividad 3 patricia sevillanos
 
Fakultät Wirtschaftswissenschaften
Fakultät WirtschaftswissenschaftenFakultät Wirtschaftswissenschaften
Fakultät Wirtschaftswissenschaften
 
Electronic Voting Machine and Fault Analysis
Electronic Voting Machine and Fault AnalysisElectronic Voting Machine and Fault Analysis
Electronic Voting Machine and Fault Analysis
 
Comunicato stampa Assocontact
Comunicato stampa AssocontactComunicato stampa Assocontact
Comunicato stampa Assocontact
 
Layman's Guide to ISO8583
Layman's  Guide to ISO8583Layman's  Guide to ISO8583
Layman's Guide to ISO8583
 
ISO8583 MySQL UDF Manual
ISO8583 MySQL UDF ManualISO8583 MySQL UDF Manual
ISO8583 MySQL UDF Manual
 
Iso8583
Iso8583Iso8583
Iso8583
 
الدفعة الثانية الدعم السكني
الدفعة الثانية الدعم السكنيالدفعة الثانية الدعم السكني
الدفعة الثانية الدعم السكني
 
ISO 8583 Financial Message Format
ISO 8583 Financial Message FormatISO 8583 Financial Message Format
ISO 8583 Financial Message Format
 
Exploring Payment Platforms - ISO 20022 and ISO 8583
Exploring Payment Platforms - ISO 20022 and ISO 8583Exploring Payment Platforms - ISO 20022 and ISO 8583
Exploring Payment Platforms - ISO 20022 and ISO 8583
 
Report on ISO8583,EDCPOS vs mPOS and EMV vs Magnetic Strip Cards
Report on ISO8583,EDCPOS vs mPOS and EMV vs Magnetic Strip CardsReport on ISO8583,EDCPOS vs mPOS and EMV vs Magnetic Strip Cards
Report on ISO8583,EDCPOS vs mPOS and EMV vs Magnetic Strip Cards
 
النسخة الالكترونية النهائية لتعميم الحركة وفتح الرغبات1438
النسخة الالكترونية  النهائية  لتعميم الحركة وفتح الرغبات1438النسخة الالكترونية  النهائية  لتعميم الحركة وفتح الرغبات1438
النسخة الالكترونية النهائية لتعميم الحركة وفتح الرغبات1438
 

Similaire à Advanced Git Presentation By Swawibe

Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
Gerrit Wanderer
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
Gareth Hall
 

Similaire à Advanced Git Presentation By Swawibe (20)

GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
Git: Overview, Pitfalls, Best Practices
Git: Overview, Pitfalls, Best PracticesGit: Overview, Pitfalls, Best Practices
Git: Overview, Pitfalls, Best Practices
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-it
 
Git github
Git githubGit github
Git github
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
 
Gittalk
GittalkGittalk
Gittalk
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Bitbucket
BitbucketBitbucket
Bitbucket
 
Git cheatsheet
Git cheatsheetGit cheatsheet
Git cheatsheet
 
Git foundation
Git foundationGit foundation
Git foundation
 
Git Acquainted
Git AcquaintedGit Acquainted
Git Acquainted
 
Git Memento of basic commands
Git Memento of basic commandsGit Memento of basic commands
Git Memento of basic commands
 
Introduction to git, a version control system
Introduction to git, a version control systemIntroduction to git, a version control system
Introduction to git, a version control system
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
Git
GitGit
Git
 
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
 
GIT Basics
GIT BasicsGIT Basics
GIT Basics
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
 

Dernier

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Dernier (20)

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 

Advanced Git Presentation By Swawibe

  • 1. Presented By: Md Swawibe Ul Alam Junior Software Engineer Nascenia Limited
  • 3. Git Merge  What it does? Join two or more development histories/branches together
  • 4.
  • 5.
  • 6.
  • 7. Git merge is 2 types:  Fast forward  No fast forward
  • 8. Example : Fast-Forward Git Merge  Let us assume that I created a topic branch named speedup from the current master. After working on this branch for a while (three commits, those white circles),I finally decided that I am done and then I pushed it to my own remote. Meanwhile, nothing else happened in the master branch.
  • 9.  Now if we use git merge using git fast- forward then my work is landed on the source tree. Because master has not been changed since the commit (gray circle).whole series of the commits will be linear. Example : Fast-Forward Git Merge
  • 10. Example : No Fast-Forward Git Merge  If we use -no-ff option (it stands for no fast-forward). In this case, the history looks slightly different (right side), there is an additional commit (dotted circle) emphasizing the merge
  • 11.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22. Git Revert  This command creates a new commit that undoes the changes from a previous commit. This command adds new history to the project (it doesn't modify existing history)  Use this to rollback changes you have committed
  • 23. Git checkout  Use this to checkout a branch or specific commit  This will rollback any changes you have in your working copy  This will NOT make any changes to the history
  • 24. Git reset  Use this to rollback changes made to the index (eg: from git add), which will NOT change the history.  Use this to change what commit a head is pointing to, which will change the history
  • 25. Cherry Pick  What git cherry-pick does, basically, is take a commit from somewhere else, and "play it back" wherever you are right now. Because this introduces the same change with a different parent, Git builds a new commit with a different ID
  • 26. Cherry Pick : Example
  • 27. ❖ If you were at node H in this graph, and you typed git Cherry-pick E you'd wind up with a copy of commit E—let's call it "E prime" or E'—that pointed to H as its parent
  • 28. ❖ if you typed something like git cherry-pick C D E
  • 29. Advanced Git Log Advanced git log can be divided into two parts : Formating log output Filtering log output
  • 30. Formating log output  Formatting shows how each commit is displayed. Available formats are-  Oneline  Decorating  Diffs  Shortlog  Graph  Custom formatting
  • 31. Oneline  The --oneline flag condenses each commit to a single line.  $ git log --oneline  output: 0e25143 Merge branch 'feature' ad8621a Fix a bug in the feature 16b36c6 Add a new feature 23ad9ad Add the initial code base
  • 32. Decorating  The --decorate flag makes git log display all of the references (e.g., branches, tags, etc) that point to each commit.  $ git log --oneline --decorate  output: 0e25143 (HEAD, master) Merge branch 'feature' ad8621a (feature) Fix a bug in the feature 16b36c6 Add a new feature 23ad9ad (tag: v0.9) Add the initial code base
  • 33. Diffs  The git log command includes many options for displaying diffs with each commit. Two of the most common options are -  --stat  The --stat option displays the number of insertions and deletions to each file altered by each commit  $ git log --stat  output:  commit f2a238924e89ca1d4947662928218a06d39068c3 Author: John <john@example.com> Date: Fri Jun 25 17:30:28 2014 -0500 Add a new feature hello.py | 105 ++++++++++++++++++++++++----------------- 1 file changed, 67 insertion(+), 38 deletions(-)
  • 34. Diffs cont..  -p  To see the actual changes introduced by each commit, pass the -p option to git log  $ git log --stat -p  output:  commit 16b36c697eb2d24302f89aa22d9170dfe609855b Author: Mary <mary@example.com> Date: Fri Jun 25 17:31:57 2014 -0500 Fix a bug in the feature diff --git a/hello.py b/hello.py index 18ca709..c673b40 100644 --- a/hello.py +++ b/hello.py @@ -13,14 +13,14 @@ B -print("Hello, World!") +print("Hello, Git!")
  • 35. Shortlog  The git shortlog command is a special version of git log intended for creating release announcements.  It groups each commit by author and displays the first line of each commit message
  • 36. Shortlog cont.. $ git shortlog output: Mary (2): Fix a bug in the feature Fix a serious security hole in our framework John (3): Add the initial code base Add a new feature Merge branch 'feature'
  • 37. Graph  The --graph option draws an ASCII graph representing the branch structure of the commit history  This is commonly used in conjunction with the -- oneline and --decorate
  • 38. Graph cont.. $ git log --graph --oneline --decorate output: * 0e25143 (HEAD, master) Merge branch 'feature' | | * 16b36c6 Fix a bug in the new feature | * 23ad9ad Start a new feature * | ad8621a Fix a critical security issue |/ * 400e4b7 Fix typos in the documentation * 160e224 Add the initial code base
  • 39. Custom formatting  For all of your other git log formatting needs the -- pretty=format:"<string>" option.  Display each commit however we want using printf- style placeholders
  • 40. Custom formatting cont $ git log --pretty=format:"%cn committed %h on %cd" output: John committed 400e4b7 on Fri Jun 24 12:30:04 2014 -0500 John committed 89ab2cf on Thu Jun 23 17:09:42 2014 -0500 Mary committed 180e223 on Wed Jun 22 17:21:19 2014 -0500 John committed f12ca28 on Wed Jun 22 13:50:31 2014 -0500
  • 41. Filtering Log Output  Filtering shows which commits are included in the output. Following commands are used for filtering-  By Amount  $ git log -3  By Date  $ git log --after="2014-7-1"  $ git log --after="yesterday"  $ git log --after="2014-7-1" --before="2014-7-4"
  • 42. Filtering Log Output Cont..  By Author  $ git log --author="John"  $ git log --author="John|Mary" //(Mary or John)  By Message  $ git log --grep="JRA-224:"  By File  git log -- foo.py bar.py  By Content  git log -S"Hello, World!"
  • 43. Filtering Log Output Cont..  By Range  $ git log master..feature  $ git log <since>..<until>  Filtering Merge Commits  $ git log --no-merges  $ git log --merges