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

Get a Jumpstart on Collaboration and Code Review in GitHub- PyLadies Remote

Get a Jumpstart on Collaboration and Code Review in GitHub- PyLadies Remote

KatherineMichel

August 26, 2017
Tweet

More Decks by KatherineMichel

Other Decks in Technology

Transcript

  1. About Me • DjangoCon US Website Chair • DEFNA (Django

    Events Foundation North America) Board Member • DjangoCon Europe Website Committee Member • Project Manager • Web Designer and Developer Twitter: @KatiMichel GitHub: KatherineMichel
  2. Goal I want to teach you a process that will

    get you started collaborating and doing code review as quickly as possible
  3. What are Git and GitHub? GitHub is a website built

    on the version control software Git. GitHub Website Git Command Line
  4. Collaboration and Code Review Best Practice Workflow You need to

    switch between multiple tasks: • Keep codebase up-to-date • Create one or more features • Do code review
  5. Working on a File in GitHub File on GitHub (README)

    Editing File Click pencil icon Edit Commit Info Save
  6. How to Create a Branch File on GitHub (README) Editing

    File Click pencil icon Edit Commit Info Save
  7. How to Create a Branch New branch and name File

    on GitHub (README) Editing File
  8. Overview • Determine which collaboration approach to use • Clone

    a repo into our local development environment, create a feature branch, make a change, push the branch to the GitHub repo, and submit a pull request • Review the two different types of pull request branches as a maintainer • Additional workflow and command info • People, communication, documentation • Recommendations • Simulation exercise
  9. The Two Collaborative Development Models • “Shared Repository” Model •

    “Fork and Pull” Model The two different models typically correspond to the two different account types and which model you use depends on whether you have write permission to the repo
  10. Write Permission When a user has write permission to a

    repo, it means they can make changes directly inside of the repo
  11. Examples of What Write Permission Will Allow You to Do

    • Edit files • Push branches directly to the repo (instead of via fork) • Merge and close pull requests
  12. Fork Submit Pull Request Fork and Pull Fork Write Permission:

    User Write Permission and Collaboration Examples Shared Repository DjangoCon US Website Repo Write Permission: Maintainers
  13. How to Fork a Repo Click the “Fork” button Click

    pencil icon to try to edit a file you don’t have write permission to DjangoCon US Website Repo
  14. How to Fork a Repo Click the “Fork” button DjangoCon

    US Website Repo GitHub will notify you that the repo is being forked Click pencil icon to try to edit a file you don’t have write permission to
  15. • Organization account owners can create teams and permissions across

    multiple repos • Otherwise, the repo “Shared Repository” settings are almost exactly the same Interesting Thing #2: User Account Shared Repo Disadvantage
  16. Interesting Thing #3: Write Permission Examples • Organization account maintainer

    • User account owner(sources and forks) • User account collaborator
  17. Section 2 • Determine which collaboration approach to use •

    Clone a repo into our local development environment, create a feature branch, make a change, push the branch to the GitHub repo, and submit a pull request
  18. DjangoCon US Website Repo Remote origin Fork and Pull Model

    My Fork Fork Clone Local Development Environment
  19. DjangoCon US Website Repo Remote origin Fork and Pull Model

    My Fork Fork Clone Push changes, including branches Local Development Environment
  20. DjangoCon US Website Repo Remote origin Fork and Pull Model

    My Fork Fork Submit Pull Request Clone Push changes, including branches Local Development Environment
  21. DjangoCon US Website Repo Push branches, submit pull requests Remote

    origin Can push or pull because of write permission, No fork needed Shared Repository Clone Local Development Environment
  22. Bash Commands Go to the home directory $ cd Change

    directory $ cd <directory-name> Move back a directory $ cd .. List the folders and files in a directory $ ls
  23. Adding and Committing $ git add . $ git commit

    -m “Creating branch and updating”
  24. Submit a Pull Request DjangoCon US Website Repo Creating a

    New Pull Request Title and Description Look over changes Create Choose branches
  25. Section 3 • Determine which collaboration approach to use •

    Clone a repo into our local development environment, create a feature branch, make a change, push the branch to the GitHub repo, and submit a pull request • Review the two different types of pull request branches as a maintainer
  26. Pull Request Review Options Do no run code locally Run

    code locally Click merge Make change in browser then click merge
  27. Pull Request Review Options Do no run code locally Run

    code locally Click merge Make change in browser then click merge No change needed, go back to browser and click merge Ask pull request author to make change You push change to pull request, then click merge You update and merge locally, push to GitHub
  28. Pull Request Branches DjangoCon US Website Repo Fork Write permission

    granted to pull request as maintainers local branches remote origin updates pull request branch git fetch origin <remote>/<branch> .git folder git pull <url> <branch> pull request branch
  29. Advanced Topics • Rebase • Interactive rebase • Squashing •

    Merge Conflicts • Aliases • Fetch individual pull request branches
  30. Section 4 • Determine which collaboration approach to use •

    Clone a repo into our local development environment, create a feature branch, make a change, push the branch to the GitHub repo, and submit a pull request • Review the two different types of pull request branches as a maintainer • Additional workflow and command info
  31. Learn More About Workflow • GitHub Flow (basically, what we’ve

    been using) • A Successful Git Branching Model (more advanced) • A Successful Git Branching Model Considered Harmful (alternative view) • SemVer • See also: Atlassian and GitLab docs
  32. Section 5 • Determine which collaboration approach to use •

    Clone a repo into our local development environment, create a feature branch, make a change, push the branch to the GitHub repo, and submit a pull request • Review the two different types of pull request branches as a maintainer • Additional workflow and command info • People, communication, documentation
  33. Getting to 10x Results Important non-coding leadership skills • Mentor/teacher

    • Communicator/collaborator • Keeping docs up to date
  34. Section 6 • Determine which collaboration approach to use •

    Clone a repo into our local development environment, create a feature branch, make a change, push the branch to the GitHub repo, and submit a pull request • Review the two different types of pull request branches as a maintainer • Additional workflow and command info • People, communication, documentation • Recommendations
  35. Additional Safety Considerations • Back up the repo • Enable

    required reviews of pull requests • Use status checks (external) • Revert pull requests, if needed • Worst case scenario: How to recover deleted branch • Sensitive data warning
  36. Productivity Tips • Password caching • Closing issues via commit

    messages • Saved replies • Link to specific line numbers on GitHub
  37. Triaging Triaging Labels • help wanted • first-timer • good

    first contribution • mentor available • up-for-grabs
  38. Debunking Myths • Myth: The repos look perfect. • Myth:

    The people working on GitHub projects must all be experts; I probably don’t fit in here. • Myth: GitHub users seem to know exactly what to do • Myth: This is all about code • Myth: I don’t want to break something
  39. Go For It! Contribute to the DjangoCon US website next

    year! We have a diverse group of contributors of all skill levels and we are always looking for more contributors. Let us know if you are interested.
  40. Section 7 • Determine which collaboration approach to use •

    Clone a repo into our local development environment, create a feature branch, make a change, push the branch to the GitHub repo, and submit a pull request • Review the two different types of pull request branches as a maintainer • Additional workflow and command info • People, communication, documentation • Recommendations • Simulation Exercise
  41. Prerequisites for Getting Started • Create a free GitHub account

    online • Install Git on your computer • Find and open your command line (a.k.a. terminal) on your computer • Be able to navigate via command line (See Bash commands) • You might also want to have a code/text editor of your choice installed
  42. Getting Help • Help via Git, GitHub Help and Guides

    • Help via command line (exit by typing “q”) • Help via GitHub Keyboard Shortcuts (type "?")
  43. Thank You! Katherine “Kati” Michel Twitter handle: @KatiMichel GitHub username:

    KatherineMichel Useful Resources: https://git.io/v5kpy