SlideShare a Scribd company logo
1 of 36
Download to read offline
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

Viewers also liked

Viewers also liked (9)

First Touch with OSGi
First Touch with OSGiFirst Touch with OSGi
First Touch with OSGi
 
Pde build
Pde buildPde build
Pde build
 
Implementing a command line client to GitHub in Go
Implementing a command line client to GitHub in GoImplementing a command line client to GitHub in Go
Implementing a command line client to GitHub in Go
 
Introducing eclipse rap
Introducing eclipse rapIntroducing eclipse rap
Introducing eclipse rap
 
Full stackagile - Squads Chapters Tribes and Guilds
Full stackagile - Squads Chapters Tribes and GuildsFull stackagile - Squads Chapters Tribes and Guilds
Full stackagile - Squads Chapters Tribes and Guilds
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
 
How to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanHow to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media Plan
 
Culture
CultureCulture
Culture
 

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

Adding Source Control to Your Life
Adding Source Control to Your LifeAdding Source Control to Your Life
Adding Source Control to Your Life
Mark Kelnar
 
RailsGirls Rotterdam - Github (and Octocats!)
RailsGirls Rotterdam - Github (and Octocats!)RailsGirls Rotterdam - Github (and Octocats!)
RailsGirls Rotterdam - Github (and Octocats!)
Anton Bangratz
 
A byte of git
A byte of gitA byte of git
A byte of git
Weng Wei
 
Python korea 2012 11-24-github
Python korea 2012 11-24-githubPython korea 2012 11-24-github
Python korea 2012 11-24-github
LINE株式会社
 
Sinatra Heroku You And You - Keynote Format
Sinatra Heroku You And You - Keynote FormatSinatra Heroku You And You - Keynote Format
Sinatra Heroku You And You - Keynote Format
Adam Lowe
 
Sinatra Heroku You And You - PDF Format
Sinatra Heroku You And You - PDF FormatSinatra Heroku You And You - PDF Format
Sinatra Heroku You And You - PDF Format
Adam Lowe
 
Codemotion 2013 - presentación cocoa pods
Codemotion  2013 -  presentación cocoa podsCodemotion  2013 -  presentación cocoa pods
Codemotion 2013 - presentación cocoa pods
Jorge Maroto
 

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

Adding Source Control to Your Life
Adding Source Control to Your LifeAdding Source Control to Your Life
Adding Source Control to Your Life
 
RailsGirls Rotterdam - Github (and Octocats!)
RailsGirls Rotterdam - Github (and Octocats!)RailsGirls Rotterdam - Github (and Octocats!)
RailsGirls Rotterdam - Github (and Octocats!)
 
Git,Github,How to host using Github
Git,Github,How to host using GithubGit,Github,How to host using Github
Git,Github,How to host using Github
 
How I become Go GDE
How I become Go GDEHow I become Go GDE
How I become Go GDE
 
EuroPython 2017 - How to make money with your Python open-source project
EuroPython 2017 - How to make money with your Python open-source projectEuroPython 2017 - How to make money with your Python open-source project
EuroPython 2017 - How to make money with your Python open-source project
 
A byte of git
A byte of gitA byte of git
A byte of git
 
Python korea 2012 11-24-github
Python korea 2012 11-24-githubPython korea 2012 11-24-github
Python korea 2012 11-24-github
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android Developers
 
Git_Git_Lab_1664715263.pdf
Git_Git_Lab_1664715263.pdfGit_Git_Lab_1664715263.pdf
Git_Git_Lab_1664715263.pdf
 
Etsy chef-workflow
Etsy chef-workflowEtsy chef-workflow
Etsy chef-workflow
 
What's new in RubyGems3
What's new in RubyGems3What's new in RubyGems3
What's new in RubyGems3
 
Git and Github workshop
Git and Github workshopGit and Github workshop
Git and Github workshop
 
Thinking in Git
Thinking in GitThinking in Git
Thinking in Git
 
Sinatra Heroku You And You - Keynote Format
Sinatra Heroku You And You - Keynote FormatSinatra Heroku You And You - Keynote Format
Sinatra Heroku You And You - Keynote Format
 
Sinatra Heroku You And You - PDF Format
Sinatra Heroku You And You - PDF FormatSinatra Heroku You And You - PDF Format
Sinatra Heroku You And You - PDF Format
 
DevNexus 2013 - Introduction to WebSockets
DevNexus 2013 - Introduction to WebSocketsDevNexus 2013 - Introduction to WebSockets
DevNexus 2013 - Introduction to WebSockets
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015
 
Codemotion 2013 - presentación cocoa pods
Codemotion  2013 -  presentación cocoa podsCodemotion  2013 -  presentación cocoa pods
Codemotion 2013 - presentación cocoa pods
 
Versions
VersionsVersions
Versions
 
Intro. to Git and Github
Intro. to Git and GithubIntro. to Git and Github
Intro. to Git and Github
 

Recently uploaded

Recently uploaded (20)

THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 

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