SlideShare a Scribd company logo
Ten Things You Didn't
                           Know Git And GitHub
                                Could Do
                                         Owen Ou
                                     @JingwenOwenOu
                     http://owenou.com/2012/01/13/ten-things-you-didnt-
                              know-git-and-github-could-do.html




Saturday, 19 January, 13
Agenda

                     • 10 GitHub tricks
                     • Demo of GitHub tricks
                     • 10 Git tricks
                     • Demo of Git tricks with pull request

Saturday, 19 January, 13
Ten GitHub Tricks




                             http://octodex.github.com/front-end-conftocat




Saturday, 19 January, 13
t: file finder




Saturday, 19 January, 13
w: branch filter




Saturday, 19 January, 13
?: list of shortcuts




Saturday, 19 January, 13
whitespace: ?w=1




Saturday, 19 January, 13
commits by range

                     • github.com/user/repo/compare/{range}
                     • range = sha1...sha2 or master...my-branch
                     • time can be considered:
                           master@{time}...master
                     • e.g. master@{2012-01-01}...master

Saturday, 19 January, 13
commits by range
                           https://github.com/rails/rails/compare/
                           master@{1.day.ago}...master




Saturday, 19 January, 13
commits by author


                     • github.com/user/repo/commits/branch
                     • appending param ?author=github_handle


Saturday, 19 January, 13
commits by author
                           https://github.com/dynjs/dynjs/commits/
                           master?author=jingweno




Saturday, 19 January, 13
.diff & .patch

                     • Add .diff or .patch to the URLs of compare
                           view, pull request or commit page
                     • diff or patch in text format
                     • e.g., easy for building tools


Saturday, 19 January, 13
.diff & .patch
                           https://github.com/rails/rails/compare/
                           master@{1.day.ago}...master.patch




Saturday, 19 January, 13
email reply




Saturday, 19 January, 13
line linking

                     • any file view
                     • click one line or multiple lines by pressing
                           SHIFT
                     • good for sharing link to a chunk of code


Saturday, 19 January, 13
line linking
                           https://github.com/jingweno/dotfiles/blob/
                           master/.gitconfig#L5-L9




Saturday, 19 January, 13
subscribing peoples
                           Mentioning users in pull requests, issues or
                           any comment will subscribe them to all
                           subsequent notifications




Saturday, 19 January, 13
autolink
                     • In pull requests, issues or any comment, sha
                           and issue number will be automatically
                           linked
                     • link sha or issue number from another
                           repository with the format of user/
                           repo@sha1 or user/repo#1
                     • e.g. rails/rails#1
Saturday, 19 January, 13
autolink




Saturday, 19 January, 13
hub

                     • command line GitHub
                     • brew install hub or gem install hub
                     • hub pull-request
                     • https://github.com/defunkt/hub

Saturday, 19 January, 13
Demo: GitHub Tricks
                     •     shortcuts: t, w, ?

                     •     ignoring whitespace: https://github.com/dynjs/dynjs/commit/
                           45ec2e9c08ad10fc28c7a6c3016ef2eab158e20e

                     •     commits by range: https://github.com/acl-services/accounts/compare/
                           master@{yesterday}...master

                     •     commits by author: https://github.com/dynjs/dynjs/commits/master?
                           author=jingweno

                     •     line linking: https://github.com/acl-services/devise-acl/blob/master/Gemfile




Saturday, 19 January, 13
Ten Git Tricks




Saturday, 19 January, 13
git log -p FILE




Saturday, 19 January, 13
git log -S'PATTERN'




Saturday, 19 January, 13
git add -p




Saturday, 19 January, 13
git rm --cached FILE




Saturday, 19 January, 13
git log ..BRANCH




Saturday, 19 January, 13
git branch --merged &
                   git branch --no-merged




Saturday, 19 January, 13
git branch --contains
                                   SHA




Saturday, 19 January, 13
git status -s




Saturday, 19 January, 13
git reflog




Saturday, 19 January, 13
git shortlog -sn




Saturday, 19 January, 13
Create Shortcuts!




Saturday, 19 January, 13
Demo: Git Tricks with
                          Pull Request

                     •     Fix the README of devise-acl

                     •     gem install omglog

                     •     hub pull-request

                     •     rebase vs. merge vs. merge --no-ff




Saturday, 19 January, 13
References
                     •     http://owenou.com/2012/01/13/ten-things-you-didnt-know-git-and-github-
                           could-do.html

                     •     ProGit: http://git-scm.com/book

                     •     Advanced Git serials by Peepcode: https://peepcode.com/products/
                           advanced-git

                     •     Git and GitHub Secrets talk by Zach Holman: http://zachholman.com/talk/
                           git-github-secrets

                     •     GitFlow: http://nvie.com/posts/a-successful-git-branching-model




Saturday, 19 January, 13
Q &A




                           http://octodex.github.com/gangnamtocat.md




Saturday, 19 January, 13

More Related Content

PDF
Git使用经验
PDF
僕とhuskyとrm -rf .git/
PDF
Intro to Git
PDF
Introducing Github and Octocats by Tony Bangratz
PPTX
WordCamp Asheville 2014: WordPress and Git
PDF
Git For The Android Developer
PDF
Git Educated About Git - 20 Essential Commands
KEY
Git isthenewsexy
Git使用经验
僕とhuskyとrm -rf .git/
Intro to Git
Introducing Github and Octocats by Tony Bangratz
WordCamp Asheville 2014: WordPress and Git
Git For The Android Developer
Git Educated About Git - 20 Essential Commands
Git isthenewsexy

Viewers also liked (9)

KEY
First Touch with OSGi
KEY
Pde build
PDF
Implementing a command line client to GitHub in Go
PPT
Introducing eclipse rap
PPTX
Full stackagile - Squads Chapters Tribes and Guilds
PDF
Learn BEM: CSS Naming Convention
PDF
SEO: Getting Personal
PPTX
How to Build a Dynamic Social Media Plan
PPTX
Culture
First Touch with OSGi
Pde build
Implementing a command line client to GitHub in Go
Introducing eclipse rap
Full stackagile - Squads Chapters Tribes and Guilds
Learn BEM: CSS Naming Convention
SEO: Getting Personal
How to Build a Dynamic Social Media Plan
Culture
Ad

Similar to Ten Things You Didn't Know Git And GitHub Could Do (20)

PDF
Git, GitHub and Open Source
PDF
Introduction to git
PPTX
Git and GitHub (1).pptx
PPTX
Using Git and BitBucket
PPTX
Hacktoberfest 2022
PDF
Version control
PDF
Git cheat-sheets
KEY
An introduction to Git.
PDF
Advanced Git Tutorial
PDF
Intro to Git and GitHub
PPTX
Get your Git on GitHub
PPTX
Git and GitHub Presentation of GDG on Campus UNSTPB
PPTX
Git and GitHub Workshop of GDG on Campus UNSTPB
PDF
PPTX
Roslyn on GitHub
PPTX
tech winter break workshop on git &git hub.pptx
PPTX
Git and GitHub
PPTX
Introduction to git and github
PPTX
Git One Day Training Notes
PPTX
Git and github
Git, GitHub and Open Source
Introduction to git
Git and GitHub (1).pptx
Using Git and BitBucket
Hacktoberfest 2022
Version control
Git cheat-sheets
An introduction to Git.
Advanced Git Tutorial
Intro to Git and GitHub
Get your Git on GitHub
Git and GitHub Presentation of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPB
Roslyn on GitHub
tech winter break workshop on git &git hub.pptx
Git and GitHub
Introduction to git and github
Git One Day Training Notes
Git and github
Ad

Recently uploaded (20)

PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
STKI Israel Market Study 2025 version august
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
WOOl fibre morphology and structure.pdf for textiles
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Architecture types and enterprise applications.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Getting Started with Data Integration: FME Form 101
PPTX
The various Industrial Revolutions .pptx
Group 1 Presentation -Planning and Decision Making .pptx
1 - Historical Antecedents, Social Consideration.pdf
Developing a website for English-speaking practice to English as a foreign la...
Univ-Connecticut-ChatGPT-Presentaion.pdf
Programs and apps: productivity, graphics, security and other tools
STKI Israel Market Study 2025 version august
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Zenith AI: Advanced Artificial Intelligence
O2C Customer Invoices to Receipt V15A.pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
WOOl fibre morphology and structure.pdf for textiles
observCloud-Native Containerability and monitoring.pptx
Getting started with AI Agents and Multi-Agent Systems
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Architecture types and enterprise applications.pdf
NewMind AI Weekly Chronicles - August'25-Week II
OMC Textile Division Presentation 2021.pptx
Getting Started with Data Integration: FME Form 101
The various Industrial Revolutions .pptx

Ten Things You Didn't Know Git And GitHub Could Do

  • 1. Ten Things You Didn't Know Git And GitHub Could Do Owen Ou @JingwenOwenOu http://owenou.com/2012/01/13/ten-things-you-didnt- know-git-and-github-could-do.html Saturday, 19 January, 13
  • 2. Agenda • 10 GitHub tricks • Demo of GitHub tricks • 10 Git tricks • Demo of Git tricks with pull request Saturday, 19 January, 13
  • 3. Ten GitHub Tricks http://octodex.github.com/front-end-conftocat Saturday, 19 January, 13
  • 4. t: file finder Saturday, 19 January, 13
  • 6. ?: list of shortcuts Saturday, 19 January, 13
  • 8. commits by range • github.com/user/repo/compare/{range} • range = sha1...sha2 or master...my-branch • time can be considered: master@{time}...master • e.g. master@{2012-01-01}...master Saturday, 19 January, 13
  • 9. commits by range https://github.com/rails/rails/compare/ master@{1.day.ago}...master Saturday, 19 January, 13
  • 10. commits by author • github.com/user/repo/commits/branch • appending param ?author=github_handle Saturday, 19 January, 13
  • 11. commits by author https://github.com/dynjs/dynjs/commits/ master?author=jingweno Saturday, 19 January, 13
  • 12. .diff & .patch • Add .diff or .patch to the URLs of compare view, pull request or commit page • diff or patch in text format • e.g., easy for building tools Saturday, 19 January, 13
  • 13. .diff & .patch https://github.com/rails/rails/compare/ master@{1.day.ago}...master.patch Saturday, 19 January, 13
  • 15. line linking • any file view • click one line or multiple lines by pressing SHIFT • good for sharing link to a chunk of code Saturday, 19 January, 13
  • 16. line linking https://github.com/jingweno/dotfiles/blob/ master/.gitconfig#L5-L9 Saturday, 19 January, 13
  • 17. subscribing peoples Mentioning users in pull requests, issues or any comment will subscribe them to all subsequent notifications Saturday, 19 January, 13
  • 18. autolink • In pull requests, issues or any comment, sha and issue number will be automatically linked • link sha or issue number from another repository with the format of user/ repo@sha1 or user/repo#1 • e.g. rails/rails#1 Saturday, 19 January, 13
  • 20. hub • command line GitHub • brew install hub or gem install hub • hub pull-request • https://github.com/defunkt/hub Saturday, 19 January, 13
  • 21. Demo: GitHub Tricks • shortcuts: t, w, ? • ignoring whitespace: https://github.com/dynjs/dynjs/commit/ 45ec2e9c08ad10fc28c7a6c3016ef2eab158e20e • commits by range: https://github.com/acl-services/accounts/compare/ master@{yesterday}...master • commits by author: https://github.com/dynjs/dynjs/commits/master? author=jingweno • line linking: https://github.com/acl-services/devise-acl/blob/master/Gemfile Saturday, 19 January, 13
  • 22. Ten Git Tricks Saturday, 19 January, 13
  • 23. git log -p FILE Saturday, 19 January, 13
  • 25. git add -p Saturday, 19 January, 13
  • 26. git rm --cached FILE Saturday, 19 January, 13
  • 27. git log ..BRANCH Saturday, 19 January, 13
  • 28. git branch --merged & git branch --no-merged Saturday, 19 January, 13
  • 29. git branch --contains SHA Saturday, 19 January, 13
  • 30. git status -s Saturday, 19 January, 13
  • 32. git shortlog -sn Saturday, 19 January, 13
  • 34. Demo: Git Tricks with Pull Request • Fix the README of devise-acl • gem install omglog • hub pull-request • rebase vs. merge vs. merge --no-ff Saturday, 19 January, 13
  • 35. References • http://owenou.com/2012/01/13/ten-things-you-didnt-know-git-and-github- could-do.html • ProGit: http://git-scm.com/book • Advanced Git serials by Peepcode: https://peepcode.com/products/ advanced-git • Git and GitHub Secrets talk by Zach Holman: http://zachholman.com/talk/ git-github-secrets • GitFlow: http://nvie.com/posts/a-successful-git-branching-model Saturday, 19 January, 13
  • 36. Q &A http://octodex.github.com/gangnamtocat.md Saturday, 19 January, 13