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.
- 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 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.
- 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.
- 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
- Static website under version control [source]
- Last change Tom made to his site (as of this class)
- We The People: https://petitions.whitehouse.gov [source]
- https://github.com
- Pick a username, enter email, password
- https://help.github.com/articles/set-up-git
- Download GitHub for Mac or GitHub for Windows
- Does the following command return a result after installation?
$ git status
- Get hands dirty with Git: http://try.github.com
- Let's try it from our own command line
$ 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
- Let's go back to GitHub and create a repository
- http://help.github.com/create-a-repo
$ git remote add origin https://github.com/username/git-workshop.git
- 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 [email protected]:username/repo-name.git
- Let's update the local README
$ cd ~/git-workshop
$ echo "* Add a bullet point to the README" >> README.md
$ git status
- Let's commit the change
$ git status
$ git commit -am "Updating the readme" # This does a 'git add' for all modified files
- Let's push your changes up
$ git status
$ git push
- Forking repositories
- Opening Issues
- Searching codebases
- Branching
$ 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
- Opening Pull Requests
- Adding service hooks
- 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