6.005 — Software Construction
**This document is a work in progress.** Use Piazza to suggest further Git tips and tricks we might include.
The purpose of this handout is to give you an idea of how to effectively use Git. The emphasis here is on *effectively*---the goal is to get you to think of Git as a tool that is actually useful (both in 6.005 and maybe even in your other projects), and not just a cumbersome series of magical incantations. This document is _not_ intended to be a stand-alone introduction to Git. We expect you to have played around with it a little bit and have some idea of what it looks and feels like.
**Optional: Git is crazy, try Gitless instead**
[**Gitless**](http://gitless.com) is a version control system built on top of Git, designed to make version control as *simple* as possible. It's 100% compatible with Git, so you can switch between them seamlessly. Gitless is an active research project in the [Software Design Group](http://sdg.csail.mit.edu) at MIT, and although the 6.005 staff can't answer questions about Gitless, there's the `gl-users@mit.edu` mailing list you can send questions to or you can contact the developer directly at `sperezde@csail.mit.edu`.
## [Background](./background.html) *Getting started & getting familiar with the command line.* ## [Configuration & Editors](./config.html) *Setting up Git.* Includes the popular section *"I do `git commit` and then I can't type!"* ## [Working locally](./local.html) *Adding files, committing changes, and reviewing history.* Also: what's a commit? What's a commit ID? ## [Working remotely](./remote.html) *Remotes, pushing, pulling, and merging.* Caveat #1: pull before you start working. Caveat #2: commit your work before you pull. ## Errors ### No repository If `git clone ssh://...` reports that it "could not read from remote repository", check your repository URL for typos. If you are sure you have the correct URL, and especially if you registered late, contact the staff to make sure a repository has been created for you. ### Can't clone Because your origin Git repository is stored on Athena and accessed with SSH, certain Athena customizations can conflict with Git's ability to clone and push. If running `git clone ssh://...` reports a "protocol error" or simply asks for your password but then hangs and does nothing, you should review any changes you made to your Athena dotfiles, especially `.bashrc.mine` and `.bash_environment`. Ask a TA for help if you are not familiar with Athena. ## Verifying that your code is on Athena - Use `git status`, which will report versions you have not pushed to Athena as "commits ahead of origin/master". - Use `git log` to review the versions you have committed. - If Didit ran a build for a version, that version is on Athena. - In your clone, run `git log --decorate` and look for a version labeled `origin/master`; that's the version on Athena, as far as your clone is aware. - This one is not a commonly-used command, but in your clone, run `git ls-remote` to connect to Athena and output the current version there. ---- ### Have fun in 6.005!