Skip to content

Instantly share code, notes, and snippets.

@shayfrendt
Created March 15, 2013 19:18
Show Gist options
  • Save shayfrendt/5172337 to your computer and use it in GitHub Desktop.
Save shayfrendt/5172337 to your computer and use it in GitHub Desktop.

Intro to Git & GitHub Workshop

This is a class outline and basic lesson plan for teaching an abbreviated 3-hour introductory course.

Initially used at the Girl Develop It RDU meetup: http://meetup.com/Girl-Develop-It-RDU/events/103131462/

During this 3-hour course, we'll explore the foundations of Git and GitHub through practical every-day commands and processes.

Objectives

  • Understand how Git works and how to apply that to day to day development
  • Learn how GitHub makes distributed collaboration both effective and enjoyable
  • Practice the use of Pull Requests to make contributions to any project

Students

Students should attempt to complete the Git and GitHub Class Prerequisites: http://teach.github.com/articles/github-class-prerequisites

It's ok if you run into issues getting set up here, we'll make sure everyone's up and running at the beginning of the class.

If you complete the prerequisites and you'd like to get a head start on Git and GitHub, we recommend looking at http://www.youtube.com/watch?v=pIGYELKPeog to get familiar with a brief overview of the basics.

Class Topics

History of Git

  • What is Git?
    • man git - "The stupid content tracker"
    • "Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals."
  • "Distributed revision control (DVCS) and source code management (SCM) system"
  • Development of Git began in April, 2005
  • Created by Linus Torvals for Linux kernel development
  • http://git-scm.com
  • Going to ignore making comparisons to centralized version control systems as it's a bit beyond the scope of this class
  • What is version control and why should we use it?
  • First job as a web designer using FTP to "deploy" website changes
    • Constantly over-writing each others changes
    • Version control helps you answer the question, "Which change came first?"
  • Remember Microsoft Word's "Track Changes" functionality? Lolz.
  • track-changes-word
  • Other version control systems you may have heard of
    • Subversion, CVS, PVCS
  • Modern developers and development teams use Git to keep track of and improve the way their code is written and shipped

Sign up for GitHub

Set up Git

$ git status
$ cd ~
$ mkdir git-workshop
$ cd git-workshop
$ ls -lah
$ echo "Git Workshop" > README.md
$ cat README.md
$ git init
$ git status
$ git add README.md
$ git status
$ git commit -m "Adding a readme"
$ git log
$ git show

Creating repositories

$ git remote add origin https://github.com/username/git-workshop.git

Cloning repositories

  • Create another new repository: https://github.com/new
    • Initialize the repository with a README this time
  • Clone the respository down to your local machine
$ git clone git@github.com:username/repo-name.git

Making changes to a file

  • Let's update the local README
$ cd ~/git-workshop
$ echo "* Add a bullet point to the README" >> README.md
$ git status

Committing to a repository

  • Let's commit the change
$ git status
$ git commit -am "Updating the readme"  # This does a 'git add' for all modified files

Pushing to repositories

  • Let's push your changes up
$ git status
$ git push

Next-Level Git and GitHub Maneuvers

$ git branch bagel-bites
$ git branch
$ git checkout bagel-bites
$ touch idea.txt
$ echo "Definitely get bagel bites." >> idea.txt
$ git add .
$ git commit -a -m "Add bagel bite idea."
$ git push -u origin new-feature

Practice

  • Try your hand at opening an issue, searching a codebase, pushing up a local repo to GitHub, opening a pull request, or just practice making changes to a codebase and committing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment