ten things you didn't know git and github could do
TRANSCRIPT
![Page 1: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/1.jpg)
Ten Things You Didn't Know Git And GitHub
Could DoOwen Ou
@JingwenOwenOuhttp://owenou.com/2012/01/13/ten-things-you-didnt-
know-git-and-github-could-do.html
Saturday, 19 January, 13
![Page 2: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/2.jpg)
Agenda
• 10 GitHub tricks
• Demo of GitHub tricks
• 10 Git tricks
• Demo of Git tricks with pull request
Saturday, 19 January, 13
![Page 3: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/3.jpg)
Ten GitHub Tricks
http://octodex.github.com/front-end-conftocat
Saturday, 19 January, 13
![Page 4: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/4.jpg)
t: file finder
Saturday, 19 January, 13
![Page 5: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/5.jpg)
w: branch filter
Saturday, 19 January, 13
![Page 6: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/6.jpg)
?: list of shortcuts
Saturday, 19 January, 13
![Page 7: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/7.jpg)
whitespace: ?w=1
Saturday, 19 January, 13
![Page 8: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/8.jpg)
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
![Page 9: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/9.jpg)
commits by range
https://github.com/rails/rails/compare/master@{1.day.ago}...master
Saturday, 19 January, 13
![Page 10: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/10.jpg)
commits by author
• github.com/user/repo/commits/branch
• appending param ?author=github_handle
Saturday, 19 January, 13
![Page 11: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/11.jpg)
commits by author
https://github.com/dynjs/dynjs/commits/master?author=jingweno
Saturday, 19 January, 13
![Page 12: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/12.jpg)
.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
![Page 13: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/13.jpg)
.diff & .patch
https://github.com/rails/rails/compare/master@{1.day.ago}...master.patch
Saturday, 19 January, 13
![Page 14: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/14.jpg)
email reply
Saturday, 19 January, 13
![Page 15: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/15.jpg)
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
![Page 16: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/16.jpg)
line linking
https://github.com/jingweno/dotfiles/blob/master/.gitconfig#L5-L9
Saturday, 19 January, 13
![Page 17: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/17.jpg)
subscribing peoplesMentioning users in pull requests, issues or any comment will subscribe them to all subsequent notifications
Saturday, 19 January, 13
![Page 18: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/18.jpg)
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
![Page 19: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/19.jpg)
autolink
Saturday, 19 January, 13
![Page 20: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/20.jpg)
hub
• command line GitHub
• brew install hub or gem install hub
• hub pull-request
• https://github.com/defunkt/hub
Saturday, 19 January, 13
![Page 21: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/21.jpg)
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
![Page 22: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/22.jpg)
Ten Git Tricks
Saturday, 19 January, 13
![Page 23: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/23.jpg)
git log -p FILE
Saturday, 19 January, 13
![Page 24: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/24.jpg)
git log -S'PATTERN'
Saturday, 19 January, 13
![Page 25: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/25.jpg)
git add -p
Saturday, 19 January, 13
![Page 26: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/26.jpg)
git rm --cached FILE
Saturday, 19 January, 13
![Page 27: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/27.jpg)
git log ..BRANCH
Saturday, 19 January, 13
![Page 28: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/28.jpg)
git branch --merged & git branch --no-merged
Saturday, 19 January, 13
![Page 29: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/29.jpg)
git branch --contains SHA
Saturday, 19 January, 13
![Page 30: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/30.jpg)
git status -s
Saturday, 19 January, 13
![Page 31: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/31.jpg)
git reflog
Saturday, 19 January, 13
![Page 32: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/32.jpg)
git shortlog -sn
Saturday, 19 January, 13
![Page 33: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/33.jpg)
Create Shortcuts!
Saturday, 19 January, 13
![Page 34: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/34.jpg)
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
![Page 35: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/35.jpg)
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
![Page 36: Ten Things You Didn't Know Git And GitHub Could Do](https://reader034.vdocument.in/reader034/viewer/2022042700/5555bdffd8b42afe5d8b5156/html5/thumbnails/36.jpg)
Q & A
http://octodex.github.com/gangnamtocat.md
Saturday, 19 January, 13