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

Git and GitHub Secrets -- GitHub Universe 2015

Git and GitHub Secrets -- GitHub Universe 2015

What do these secrets look like to someone who works at GitHub? There are a few ways to answer. In teaching others how to use Git and GitHub, we have found certain useful, well-documented features remain under-appreciated and under-used. In building GitHub, we have developed a few techniques for using the platform with maximum efficiency. This session aims to cover both "types" of secrets, with a bias for the practical over the esoteric.

Patrick McKenna

October 02, 2015
Tweet

More Decks by Patrick McKenna

Other Decks in Technology

Transcript

  1. @patrickmckenna ! " Universe Git & GitHub Secrets - secret

    subjective, aiming for practical rather than esoteric - 2 areas of focus: - under-appreciated features - things we do at GitHub
  2. ! @patrickmckenna " Universe Get commits by author user/repo/commits?author=user Assume

    you're a team lead. You've been assigned to take over an existing project, and want a quick sense for who's done what. It's hard to beat the speed of a URL bar, so you get commits by author.
  3. ! @patrickmckenna " Universe Compare view user/repo/compare You also want

    a sense of how much progress has been made on a particular feature branch, so you bring up github.com's compare view.
  4. ! @patrickmckenna " Universe Compare view user/repo/compare/commit-ish… commit-ish If you

    know the revisions you’d like to compare… - commit-ish meaning commit sha, branch, tag, time
  5. ! @patrickmckenna " Universe Suppress whitespace changes <diff-url>?w=1 That leads

    you to one diff that includes whitespace errors, and you don't want those cluttering up the screen, so: add `?w=1` to diffs to suppress whitespace changes
  6. ! @patrickmckenna " Universe Highlight lines user/repo/blob/commit-ish/ pathspec#L1-L2 In another

    commit listed in that compare view, you find a particularly clever (or problematic) few lines of code. You want to share this with your team, but don't want to just include a link to the whole file. So you: highlight lines of plaintext file
  7. @patrickmckenna " Universe - nb: works for plaintext, not rendered

    types like Markdown - can also generate URL by clicking on lines, then shift-clicking subsequent lines as needed
  8. ! @patrickmckenna " Universe Avatar URL user.png To celebrate the

    dev whose work you're highlighting, you decide to include their face in the `README`, as a visual thank you.
  9. ! @patrickmckenna " Universe Pre-populated threads /user/repo/issues/new? title=your_title_here& labels%5B%5D=your_label_here& body=your_text_here

    Later, in browsing through the project's Issues, you find yourself wishing there was a consistent format used for new Issues. That leads you to include in the `README` links for new, pre-populated threads.
  10. ! @patrickmckenna " Universe Keyboard shortcuts shift + ? You

    don't like using the trackpad. So you try this.
  11. ! @patrickmckenna " Universe Fuzzy file finder t After celebrating,

    you recall the task at hand: review the current implementation of `foo`, the definition of which lives in a filename you can't quite remember. No fear, you use:
  12. ! @patrickmckenna " Universe Search syntax help.github.com/categories/search/ Alternate path 1:

    you can't remember even part of the filename, so you look for associated Issues and Pull Requests using the search filters.
  13. ! @patrickmckenna " Universe Commits that touch given function git

    log -L :<function>:<file> Alternate path 2: you reach for command-line Git tools to find out where `foo` is declared/defined/called
  14. ! @patrickmckenna " Universe Commits that introduce/remove given string git

    log -S <string> can search for strings other than function names
  15. ! @patrickmckenna " Universe Create empty commit git commit --allow-empty

    Upon reviewing `foo`, you think: this needs some refactoring. You know the file to edit, but you're not sure where to start. In essence, you'd like to open a PR to begin the discussion, but aren't sure what changes to make. Use this trick to get the required unique commit for opening a PR, w/o actually changing a thing.
  16. ! @patrickmckenna " Universe Thread keywords fix(es)(ed) close(s)(d) resolve(s)(d) In

    that PR's OP, you remember to link to and auto-close the several Issues that originally brought `foo`'s problems to your attention, using these keywords.
  17. ! @patrickmckenna " Universe Canonical URL y In the PR

    itself, you find a need to link to a specific version of a different file.
  18. ! @patrickmckenna " Universe Default file URL user/repo/blob/branch/pathspec The default

    URL specifies the file as it appears on a given branch, but branches move forward in time.
  19. @patrickmckenna " Universe despite appearances, 08dd is actually a commit

    object - URL implies blob - dropdown implies tree
  20. @patrickmckenna " Universe Ok, your team is really getting down

    to business with this refactoring. They've opened a few PRs on your PRs, and you need to inspect these locally. What if you don't want to leave the CLI?
  21. ! @patrickmckenna " Universe Recover original conflict git checkout --

    conflict=<merge|diff3> Inspired, you jump into the code yourself. You've made a few local branches to test out your ideas (branching is cheap, remember?). While merging locally, however, you get into a bit of a mess
  22. ! @patrickmckenna " Universe Get original versions during merge conflict

    git show :N:<pathspec> > <filename> N = 1 common parent 2 = your version 3 = `MERGE_HEAD`
  23. ! @patrickmckenna " Universe Univers(al) GitHub for non-developers You love

    building stuff on GitHub. How do you get others using it more? Turns out even those not directly contributing to source code can really love using GitHub. One prime example: our legal team.