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

Git/GitHub Seminar

Git/GitHub Seminar

Two hour-long seminar on Git/GitHub.

Jogendra Kumar

March 28, 2019
Tweet

More Decks by Jogendra Kumar

Other Decks in Technology

Transcript

  1. View Slide

  2. Jogendra Kumar
    @jogendra

    View Slide

  3. About Me
    ● Pre-final year student at Indian Institute of Technology Varanasi
    ● Open Source Contributor and Maintainer at FOSSASIA
    ● iOS Developer
    ● Google Summer of Code (2018) student developer for FOSSASIA
    ● Sometime do Web Development and Blockchain Stuff
    ● Mistakenly done Windows Development
    ● GitHub Campus Expert!
    ● Mentored several Open Source Programs including Google
    Code-In and mentoring Google Summer of Code 2019 students
    jogendra imjog24 https://jogendra.github.io

    View Slide

  4. version control with git

    View Slide

  5. What is version
    control?

    View Slide

  6. why git?

    View Slide

  7. View Slide

  8. - A powerful easy to use DVCs
    - The most used VCSs in the world

    View Slide

  9. history:
    Know exactly which files changed, who made those
    changes, and when those changes occured.
    backup:
    Ability to have different versions of the code in different
    places.
    collaboration:
    Collaborate easily with other people on the same
    codebase

    View Slide

  10. workshop outline

    View Slide

  11. my first git: repositories, staging, committing
    git good: branching, jumping around, merging
    git world: enter in the repository world
    git ideas: cool stuff to do with git
    open sourcing: the idea that it’s a changing.

    View Slide

  12. $ terminal commands are typed
    with this font and color.
    before we begin...

    View Slide

  13. don’t worry!
    there is always a cheat sheet!

    View Slide

  14. my first git
    Create your shiny repo and your first commit.

    View Slide

  15. what is a repository?
    A repository is like any other folder on your
    computer, it can contain any type of file and
    works in exactly the same way…
    Except:
    It has a hidden file named ".git" that stores the
    history of that folder

    View Slide

  16. Local Repository?
    - The local repo is on your computer.
    - It has all the files and their commit history.
    - It enables full diffs, history review, and
    committing when offline.

    View Slide

  17. Remote Repository?
    - The local repo on cloud in someone else
    computer.
    - You can host you remote repo on platforms
    like GitHub/GitLab/Bitbucket.
    - It enables all the things you can do with your
    local repo.

    View Slide

  18. Let's take a look at

    View Slide

  19. first, install git

    View Slide

  20. Install Git for Linux
    If you’re on Fedora (or any closely-related RPM-based distribution, such as
    RHEL or CentOS), you can use dnf:
    If you’re on a Debian-based distribution, such as Ubuntu, try apt:

    View Slide

  21. Install Git on MacOS
    There are several ways to install Git on a Mac. The easiest is probably to install
    the Xcode Command Line Tools.

    View Slide

  22. Install Git on Windows
    Just go to:

    View Slide

  23. second, start a new repository by
    $ git init

    View Slide

  24. what are commits?
    snapshots of the state (e.g. code) of your
    repository

    View Slide

  25. commit your work by using
    $ git add .
    $ git commit -m “”

    View Slide

  26. more about commits
    Bc7fd9
    “Add
    Oranges”
    a3ffde
    “Add apples”
    9cd1ce
    “First commit,
    Add fruit.txt”
    Commits form a linked list
    structure which shows
    what you have done over
    time.
    Use git log to see your
    commit history.

    View Slide

  27. staging changes
    Unstaged
    Changes
    Staged
    Changes
    Committed
    Changes
    git add git commit
    git reset
    git reset .

    View Slide

  28. my first git: recap
    $ git init - converts a folder to a super smart git
    repository.
    $ git add - adds the files you want to be tracked to the
    staging area.
    $ git commit - creates a new snapshot of your
    repository at that point in time.
    $ git reset - Undo your commit or unstage your files.
    $ git log - View your commit history.
    $ git status - See the current status of your
    repository

    View Slide

  29. Let's take a look at

    View Slide

  30. git good
    branching, context switching, merging

    View Slide

  31. Bc7fd9
    “Add oranges”
    a3ffde
    “Add apples”
    9cd1ce
    “First commit,
    Add fruit.txt”
    commits

    View Slide

  32. working with branches
    $ git branch - see a list of all available branches.
    $ git branch - create a new
    branch with the desired name, based on the current
    branch.

    View Slide

  33. Bc7fd9
    “Add oranges”
    a3ffde
    “Add apples”
    9cd1ce
    “First commit,
    Add fruit.txt”
    master
    commits branches

    View Slide

  34. working with HEAD
    $ git checkout - Redirect HEAD to
    the desired branch

    View Slide

  35. Bc7fd9
    “Add oranges”
    a3ffde
    “Add apples”
    9cd1ce
    “First commit,
    Add fruit.txt”
    master
    commits branches
    HEAD
    HEAD
    somebranch

    View Slide

  36. merging = combining commits
    $ git merge - creates a new
    commit that combines the last commit of the
    current HEAD branch with the last commit of the
    desired branch.

    View Slide

  37. git good: recap...
    $ git branch - List all branches
    $ git branch - creates a branch with that
    name
    $ git checkout - jump to the branch with
    this name
    $ git merge --no-ff - merge the branch
    with this name into the current one.

    View Slide

  38. git world
    publishing, updating and downloading

    View Slide

  39. Let's take a look at

    View Slide

  40. downloading / updating Repos
    $ git clone - downloads a copy of a
    remote git repository.
    $ git pull - performs a merge of what you
    have on your computer with what's on the
    server.
    $ git push - sends your version to the
    server.

    View Slide

  41. git ideas
    a quick look at what other folks
    are doing on

    View Slide

  42. View Slide

  43. programs and technology leadership at your school
    and much more...

    View Slide

  44. Student Developer Pack by
    The best developer tools,
    free for students
    education.github.com/pack

    View Slide

  45. GitHub Campus Experts
    GitHub Campus Experts enrich the
    technology communities on their
    campuses.

    View Slide

  46. GitHub for Education GitHub for Science GitHub for Government
    for X
    and much more...

    View Slide

  47. Host your personal page for free on

    View Slide

  48. Collections on
    open and explore the vast world of repositories
    that exist. I'm sure you'll be surprised!
    Social Impact Learn to Code Organizations Open Journalism
    and much more...

    View Slide

  49. #OpenSourcing
    Understand more about the movement that is
    changing the way you collaborate.

    View Slide

  50. and many others ...
    Communities on
    open and explore communities that do a change in
    the open source world.
    and much more...

    View Slide

  51. Events on
    open and participate in events that happens
    around the world in prol of the open source.
    and much more...
    24 Pull Requests Hacktoberfest GitHub Field Day

    View Slide

  52. View Slide

  53. time to start the workshop!

    View Slide

  54. Doubts? Suggestions? Feedback?
    Your opinion is worth gold stickers!

    View Slide

  55. Let's take a picture?
    Share on social networks and check @imjog24
    @jogendra #githubeducation

    View Slide

  56. Thank you!
    @jogendra /in/jogendrasingh24

    View Slide

  57. View Slide