CS170: Programming for the World Around Us - Working with Git Repositories

Developed by Professor Tralie and Professor Mongan.


Please watch the video below, and when you're finished, click the "NEXT" button to proceed.
Note that some videos may show "Resource Unavailable" as the thumbnail - this is just the preview, and the video should play normally upon clicking the "Play" button.

Practicing the Commit-and-Push Cycle

Now that you have seen what git and GitHub are for, this module walks through the day-to-day cycle you will use on every assignment. A few tips as you watch:

  • Commit messages matter. A message like git commit -m "add loop to count words in each line" tells future-you (and your instructor) exactly what changed. Messages like “stuff” or “asdf” do not!
  • git status is your friend. Whenever you are unsure what git is thinking, run git status: it shows which files you have changed and which are staged for your next commit.
  • Push before you walk away. A commit that only lives on your laptop cannot be graded (and cannot be recovered if your laptop is lost). End every work session with a git push.
  • Nothing you commit is ever lost. If your program worked an hour ago and doesn’t now, your old commits still hold the working version — ask your instructor how to view or restore an earlier commit, or browse your commit history on github.com.

When you’re finished with the video, continue to the next module to see how assignments are handed out and collected with GitHub Classroom.