Git & GitHub Versus Other Version Control Systems • How to Use Github • Git -- The Basic Idiom • Git – Branches • Collaborating with Others -- Break -- • Setup GitHub Account • Setup Git on Your Computer • Free Form Lab Time • Wrap Up
realised it was a mistake and wanted to go back? • Lost code or had a backup that was too old? • Wanted to see the difference between two versions of your code? • Wanted to prove that a particular change broke or fixed some piece of code? • Wanted to experiment with a new feature without interfering with working code? http://stackoverflow.com/questions/1408450/why-should-i-use-version-control
backed up • If you work with documents that change a lot or have multiple versions (think software,design, and document work) • If you work on a team project • If you apply for engineering/developer positions When should I use it?
• Bazaar Centralized • Subversion (SVN) • Concurrent Versions System (CVS) Remote Repository Hosting Services • GitHub • BitBucket • Your Own Server • Lots of other services!
Yeah, it doesn’t cut you any slack, but the tradeoff is that you get complete control • Everybody can see my stuff on GitHub. ◦ True, but you get to participate in a development community and are on your way to contributing to an open source project. If you want a private repo that only you and collaborators can see, you can pay for one on Github or use a hosting service that offers free private repos like Bitbucket.
set available • You have a built in help function called the MAN page • If you are pair programming with someone else, you won’t need to learn their client.
am deliberately not providing instructions here because GitHub changes its interface all the time. My instructions would quickly become outdated. Google is your friend :)
what others have done ◦ resolve merge conflicts early • git add <filename> ◦ let me bundle some work together • git commit -m “my comment” ◦ get me make a note about that bundle ◦ -m -- that’s a flag that says use no editor, use the string ◦ MAN page • git push ◦ send it up to the hosting service
timeline • git log ◦ give me the history • git log --pretty=oneline ◦ give me a simplified log • git stash save “note about what I am saving” ◦ My current work is not ready to be shared but I want to git pull and see what’s going on with the remote repo • git stash pop ◦ give me the last stashed change • git stash list
an easy way to have two parallel streams of work until you are ready to settle on one solution. • Lets you mix-and-match features from each branch. • Branches are often used for development in a professional environment.
branch -a • Get a remote branch onto your local machine ◦ git checkout --track origin/<branch name> • Cut New Branch ◦ Make local branch ▪ git branch <branch name> ◦ Make remote branch ▪ git push -u origin <branch name> • Switch to a Branch ◦ git checkout <branch name>
contributing to open source projects ◦ using code created by others ◦ http://xkcdgraphs.com/ • Shared Repo ◦ How a professional office would use git ◦ Git Workflow
Practice what’s already happened in Lecture ◦ clone [email protected]:sarahelizgray/reptiles.git • Discover advanced features by playing a game ◦ https://rubygems.org/gems/githug Lab Time
and other VCS • You know about GitHub and other hosting services • You have git and GitHub ready to go! • You know the basic idiom • You some advanced ideas like branches and git workflow • You know how to call the MAN page • You have a git cheatsheet
http://www.ndpsoftware.com/git-cheatsheet.html • Continue with Githug ◦ https://rubygems.org/gems/githug • A great in-depth guide to git, also a book ◦ http://git-scm.com/book • The Original Git and Github GDI Class Slides ◦ http://teach.github.com/presentations/git-foundations.html • More on Git Workflow ◦ https://www.atlassian.com/git/workflows#!workflow-gitflow • More Silly Ryan Gosling Programming Jokes ◦ http://programmerryangosling.tumblr.com/