4. Git and GitHub¶
Git is a tool for version control, a system for recording changes to files over time with the ability to return you to any version. Version control is a cornerstone of modern software development: it enables multiple developers contribute to a project without fear of losing work.
To get started, watch the Git Basics slidecast (~35 minutes) demonstrating the use of Git to track files in version control. The slidecast includes demos of the following:
Now watch the Social Git slidecast (~40 minutes) showing how Git can enable version control and code sharing across a team. The slidecast contains demos of the following:
If time permits, review these additional pages:
You will need to complete the Setting Up instructions before you proceed with these exercises. Once you are set up, SSH into tottbox using the
vagrant ssh command from the setup instructions. Then tackle the problems below. Document what you find in a gist and share it with the TotT community later.
4.3.1. Immerse yourself¶
Visit the Git Immersion web site. Starting on lab #3, complete all the labs up through #28, skipping #22 and #23. The labs will take you through cloning, staging, committing, branching, and merging in a practice Ruby project. It will also teach you some handy commands supporting a typical git workflow.
You should perform all the lab exercises in a subfolder under
/vagrant on tottbox. For instance,
/vagrant/version/git_immersion or similar will work. Remember, this directory also appears on your laptop in the folder you setup for your course work in the first assignment. Feel free to use SublimeText or your preferred text editor to create and edit the files in the tutorials, but execute the git commands in a tottbox terminal.
4.3.2. Diagram git¶
Draw a little diagram of your interactions with git in the Git Immersion tutorial so far. What effect do your commands have on your working directory, the stage, the master branch, and other branches?
Use plain text to create the diagram or an online tool like actdiag.
4.3.3. Continue the Immersion¶
4.3.4. Practice pull requests¶
GitHub supports the integration manager Git workflow by way of pull requests. Practice this model by visiting https://github.com/parente/tott-roster and following the instructions there.
4.3.5. Update your diagram¶
Update the diagram you drew in the last class session to include the concepts of pulling and pushing. How do these impact your local repository? The remote one?
- Try Git
- Interactive Git tutorial right in your browser
- Ten Git Tutorials for Beginners
- A nice top-10 list of Git tutorials to review if you want alternatives to the prep material.
- Interactive Git Cheatsheet
- Visualization show what components common Git commands affect
- A Visual Git Guide
- Visual reference of how common Git commands work