Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

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

Git and GitHub are powerful tools. Even if you have worked with them for a long time, it’s likely that you haven’t stumbled across everything yet. I collect 10 common tricks for both Git and GitHub that potentially increase your day-to-day productivity.

Jingwen Owen Ou

January 18, 2013
Tweet

More Decks by Jingwen Owen Ou

Other Decks in Programming

Transcript

  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. 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
  4. .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
  5. 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
  6. subscribing peoples Mentioning users in pull requests, issues or any

    comment will subscribe them to all subsequent notifications Saturday, 19 January, 13
  7. 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
  8. hub • command line GitHub • brew install hub or

    gem install hub • hub pull-request • https://github.com/defunkt/hub Saturday, 19 January, 13
  9. 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
  10. 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
  11. 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