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

PyCon 2019 Mentored Sprint for Diverse Beginners Git Intro

PyCon 2019 Mentored Sprint for Diverse Beginners Git Intro

Nina Zakharenko

May 04, 2019
Tweet

More Decks by Nina Zakharenko

Other Decks in Technology

Transcript

  1. !
    slides: bit.ly/mentoredgit
    Getting started with Git
    Mentored Sprints for Diverse
    Beginners
    #MentoredSprint
    #PyCon2019
    @nnja

    View Slide

  2. Cloning Today
    For slow conference wifi, clone like this:
    git clone --depth 1 https://github.com/django/
    django.git
    @nnja

    View Slide

  3. Prerequisites:
    4 a GitHub.com account
    4 Please log in.
    4 git installed locally
    4 In your terminal program, typing git version
    should return a number.
    @nnja

    View Slide

  4. git vs GitHub
    @nnja

    View Slide

  5. What makes a folder a "git
    repository?"
    Only one thing -- the existence of a .git directory.
    Once this directory is present, you'll be able to run the
    git status command.
    @nnja

    View Slide

  6. Forks
    !
    4 Since you want to contribute back, we'll make a
    "fork".
    4 A "fork" is our local copy of the source code.
    @nnja

    View Slide

  7. Fork Demo
    @nnja

    View Slide

  8. Cloning
    4 Once you've made a fork, let's clone it locally.
    4 Grab the URL from GitHub
    4 Run git clone , just paste it in!
    @nnja

    View Slide

  9. https://info201-s17.github.io/book/git-collaboration.html

    View Slide

  10. Clone Demo
    @nnja

    View Slide

  11. Three Areas Where Code
    Lives
    @nnja

    View Slide

  12. @nnja

    View Slide

  13. Commits
    4 Mark the files you're ready to share
    4 A specific file
    4 git add
    4 All the change
    4 git add .
    4 git commit -m "message"
    @nnja

    View Slide

  14. Destructive Operations
    4 Be careful running this!
    4 It will delete your changes.
    4 git checkout --
    4 You won't be able to get them back
    @nnja

    View Slide

  15. Stash
    4 A stash is a safe place to temporarily store your changes
    4 Only stash files git knows about:
    4 git stash
    4 Include files git doesn't know about:
    4 git stash --include-untracked
    4 Bring your changes back
    4 git stash apply
    @nnja

    View Slide

  16. Branching
    @nnja

    View Slide

  17. 4 Make a new branch:
    4 git branch
    4 "Checking out" a different branch
    4 git checkout
    @nnja

    View Slide

  18. Push / Syncing
    4 Push to server
    4 git push origin my_branch
    4 Pull from server
    4 git pull
    @nnja

    View Slide

  19. Logs
    4 git log
    @nnja

    View Slide

  20. Opening a PR Demo
    @nnja

    View Slide

  21. Need git or GitHub help?
    4 Find the git help desk
    4 ask your mentors
    4 most of all, have fun!
    @nnja

    View Slide