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

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

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

KatherineMichel

September 24, 2020
Tweet

More Decks by KatherineMichel

Other Decks in Programming

Transcript

  1. About Me • Pinax Maintainer/Web Developer • DjangoCon US Website

    Co-Chair • DEFNA (Django Events Foundation North America) Board Member Twitter: @KatiMichel GitHub: KatherineMichel
  2. Talk Goal I want to teach you a process that

    will get you started collaborating and doing code review as quickly as possible
  3. Good News! • This isn’t about how much you know…

    this is about knowing enough to be proficient
  4. Good News! • Git and GitHub are a highly valuable,

    “gateway” skill... becoming proficient leads to many other opportunities
  5. More Good News… Hacktoberfest! • A month-long celebration • Four

    PRs = shirt and swag • Great time to contribute https://hacktoberfest.digitalocean.com/
  6. 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
  7. Housekeeping • Even though I use the word “code” in

    the title, this is more about the process and not specific to code • GitHub provides assistance by operating system: https://docs.github.com/en/github/using-git
  8. What are Git and GitHub? GitHub is a website built

    on the version control software Git. GitHub Website Git Command Line
  9. Workflow Overview • Determine which collaboration approach to use •

    Learn about branches • Work on a branch in a local development environment, push the branch to GitHub, and submit a pull request • Review the two different types of pull requests as a maintainer • Hacktoberfest… how to get started!
  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. Working on a File in GitHub File on GitHub (README)

    Editing File Click pencil icon Edit Commit Info Save
  16. Benefits to Using Branches • To keep your main branch

    stable • To work on features outside of the main branch, which may also take time • So that you can test and review code before merging it into your main branch
  17. How to Create a Branch File on GitHub (README) Editing

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

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

    Learn about branches • Work on a branch in a local development environment, push the branch to GitHub, and submit a pull request
  20. DjangoCon US Website Repo remote origin Fork and Pull Model

    My Fork Fork Clone Local Development Environment
  21. DjangoCon US Website Repo remote origin Fork and Pull Model

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

    My Fork Fork Submit Pull Request Clone Push changes, including branches Local Development Environment
  23. 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
  24. 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
  25. Adding and Committing $ git add . $ git commit

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

    New Pull Request Title and Description Look over changes Create Choose branches
  27. Workflow Overview • Determine which collaboration approach to use •

    Learn about branches • Work on a branch in a local development environment, push the branch to GitHub, and submit a pull request • Review the two different types of pull requests as a maintainer
  28. Pull Request Review Shared Repo Branch Forked Repo Branch $

    git fetch origin $ git checkout -b <branch-name> origin/<branch-name> $ git merge main $ git push origin <branch-name> $ git checkout -b <branch-name> main $ git pull https://github.com/<user-name>/<repo-name> <branch-name> $ git push https://github.com/<user-name>/<repo-name> <branch-name>
  29. Workflow Overview • Determine which collaboration approach to use •

    Learn about branches • Work on a branch in a local development environment, push the branch to GitHub, and submit a pull request • Review the two different types of pull requests as a maintainer • Hacktoberfest… how to get started!
  30. Sandboxing Create a repo and use it to practice your

    workflow https://guides.github.com/activities/hello-world/
  31. Simple, But Effective You have cloned and cd into the

    directory Check branch $ git branch Update main branch $ git pull Create a new branch $ git checkout -b <branch-name>
  32. Simple, But Effective Make our change… Add and commit changes

    $ git add . $ git commit -m “Your note” Push to GitHub $ git push origin <branch-name> Hypothetically, submit a pull request
  33. Pushing Commits to a Pull Request Push to shared repo

    PR branch $ git push origin <branch-name> Push to a forked repo PR branch $ git push https://github.com/<user-name>/<repo-name> <local-branch-name>:<remote-branch-name>
  34. Triaging Triaging Labels • hacktoberfest • first-timer • good first

    contribution • mentor available • up-for-grabs • help wanted
  35. When You Locate a Project • Use the GitHub Contributing

    Checklist • Look for a CONTRIBUTING.md Let them know if you: • Find an issue you want to take • Think of a feature that you want to add
  36. Newcomer Perspective is Valuable! • Project veterans may be unable

    to see the project through the eyes of a beginner • Improve things for the next person • Create installation docs ◦
  37. When You Get Stuck • Google • Stack Overflow •

    GitHub docs • Git docs • Atlassian and GitLab docs
  38. Go For It! Katherine “Kati” Michel Twitter handle: @KatiMichel GitHub

    username: KatherineMichel Useful Resources: https://git.io/JU2AR