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

1,538 views
1,368 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,538
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

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

  1. 1. Ten Things You Didnt 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.htmlSaturday, 19 January, 13
  2. 2. Agenda • 10 GitHub tricks • Demo of GitHub tricks • 10 Git tricks • Demo of Git tricks with pull requestSaturday, 19 January, 13
  3. 3. Ten GitHub Tricks http://octodex.github.com/front-end-conftocatSaturday, 19 January, 13
  4. 4. t: file finderSaturday, 19 January, 13
  5. 5. w: branch filterSaturday, 19 January, 13
  6. 6. ?: list of shortcutsSaturday, 19 January, 13
  7. 7. whitespace: ?w=1Saturday, 19 January, 13
  8. 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}...masterSaturday, 19 January, 13
  9. 9. commits by range https://github.com/rails/rails/compare/ master@{1.day.ago}...masterSaturday, 19 January, 13
  10. 10. commits by author • github.com/user/repo/commits/branch • appending param ?author=github_handleSaturday, 19 January, 13
  11. 11. commits by author https://github.com/dynjs/dynjs/commits/ master?author=jingwenoSaturday, 19 January, 13
  12. 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 toolsSaturday, 19 January, 13
  13. 13. .diff & .patch https://github.com/rails/rails/compare/ master@{1.day.ago}...master.patchSaturday, 19 January, 13
  14. 14. email replySaturday, 19 January, 13
  15. 15. line linking • any file view • click one line or multiple lines by pressing SHIFT • good for sharing link to a chunk of codeSaturday, 19 January, 13
  16. 16. line linking https://github.com/jingweno/dotfiles/blob/ master/.gitconfig#L5-L9Saturday, 19 January, 13
  17. 17. subscribing peoples Mentioning users in pull requests, issues or any comment will subscribe them to all subsequent notificationsSaturday, 19 January, 13
  18. 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#1Saturday, 19 January, 13
  19. 19. autolinkSaturday, 19 January, 13
  20. 20. hub • command line GitHub • brew install hub or gem install hub • hub pull-request • https://github.com/defunkt/hubSaturday, 19 January, 13
  21. 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/GemfileSaturday, 19 January, 13
  22. 22. Ten Git TricksSaturday, 19 January, 13
  23. 23. git log -p FILESaturday, 19 January, 13
  24. 24. git log -SPATTERNSaturday, 19 January, 13
  25. 25. git add -pSaturday, 19 January, 13
  26. 26. git rm --cached FILESaturday, 19 January, 13
  27. 27. git log ..BRANCHSaturday, 19 January, 13
  28. 28. git branch --merged & git branch --no-mergedSaturday, 19 January, 13
  29. 29. git branch --contains SHASaturday, 19 January, 13
  30. 30. git status -sSaturday, 19 January, 13
  31. 31. git reflogSaturday, 19 January, 13
  32. 32. git shortlog -snSaturday, 19 January, 13
  33. 33. Create Shortcuts!Saturday, 19 January, 13
  34. 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-ffSaturday, 19 January, 13
  35. 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-modelSaturday, 19 January, 13
  36. 36. Q &A http://octodex.github.com/gangnamtocat.mdSaturday, 19 January, 13

×