ud775 ยป

Instructor Notes for Lesson 1

Contents

Morsel 2: Course overview

Check out this page for some tutorials to get started using a Unix-style command line.

Morsel 4: Finding Diffs Between Larger Files

Asteroids Game

If you're interested, you can play the Asteroids game on Doug's website.

Downloading the old and new versions of the file

You can get the two versions of the game.js file in the Downloadables section on this page.  Here's how to get them on to your computer:

  • Click on the file you want in the Downloadables section
  • In the new tab that opens, right click and choose Save As

Make sure to take note of where you download them!

Mistake in Solution

When showing the output of running diff on Mac, Caroline accidentally showed the output of diff -u game_new.js game_old.js, that is, she put the files in the incorrect order. (She showed typing the correct command, but the output shown is from running the command with the arguments reversed). If you've run your command correctly, your output should be the reverse of Caroline's: that is, you should see minus signs where she has plus signs and vice versa.

Morsel 5: Reflections

Like Sarah said, there is a lot of research out there on reflection.  If you want a quick intro with some neat graphics, check out this site.

For a more in-depth look, check out this seminal 20-page paper on the topic.

Morsel 14: One Commit per Logical Change

What is a README?

Many projects contain a file named "README" that gives a general description of what the project does and how to use it.  It's often a good idea to read this file before doing anything with the project, so the file is given this name to make users more likely to read it.

Morsel 21: Cloning and Exploring The Repo

Cloning a Repository

To clone a repository, run git clone followed by a space and the repository URL.

Asteroids URL

Use the following url to clone the Asteroids repository: https://github.com/udacity/asteroids.git

Exiting git log

To stop viewing git log output, press q (which stands for quit).

Getting Colored Output

To get colored diff output, run git config --global color.ui auto

Copying and Pasting from the Command Line

To complete this quiz, you'll want to copy and paste some commit ids.

Windows
To copy and paste within Git Bash, follow the instructions on this page.

Mac
To copy and paste within the terminal on Mac, use Cmd+C and Cmd+V

Ubuntu
To copy and paste within the terminal on Ubuntu, use Ctrl+Shift+C and Ctrl+Shift+V.

Using git log and git diff

As a reminder, running git log will show a list of the recent commits with information about them, including commit IDs.  Running git diff followed by two commit IDs will compare the two versions of the code in those commits.  If you need a refresher, you may want to rewatch this video.

Entering commit IDs

If it is easier, you may enter the first four or more characters of the commit ID rather than pasting the entire ID.

Morsel 23: Concept Map: repository, clone, log

Instructions

Check each concept you thing log should be connected to.  For each concept you check, write the connection type ("type-of", "part-of", or "operates-on") you think applies in the box next to it.  If none of the existing connection types work, write "other".

Morsel 25: Checking Out Old Versions of Code

QuickEdit Mode

To make copying and pasting in GitBash easier by turning on QuickEdit mode, follow the instructions here.

Most Recent Commit

The commit ID of the most recent commit is 3884eab839af1e82c44267484cf2945a766081f3.  You can use this commit ID to return to the latest commit after checking out an older commit.

Format of git checkout

The command Caroline types to checkout the "Revert controls" commit is git checkout b0678b161fcf74467ed3a63110557e3d6229cfa6.

Windows Explorer

When Caroline mentions opening a "file navigation GUI" on Windows, she is referring to the Windows Explorer.

Entering commit IDs

If it is easier, you may enter the first four or more characters of the commit ID rather than pasting the entire ID.

Morsel 29: Setting Up Your Workspace on Windows

Changing background color

If you prefer the background color of Git Bash to be something other than black, you can change it in the "Defaults" menu under the "Colors" tab.  If you like the background color as-is, you don't need to make any changes.

Downloading necessary files

  • Save this file in your home directory with the name git-completion.bash.
  • Save this file in your home directory with the name git-prompt.sh.
  • Save bash_profile_course from the Downloadables section in your home directory with the name .bash_profile.  (If you're curious to learn more about how bash prompts work, see this page.)

Making Git configurations

Run the following Git configuration commands.  The first one will need to be modified if you are using a text editor other than Sublime, or if Sublime is installed in another location for you.  See this page for the correct command for a couple of other popular text editors.  For any other editor, you'll need to enter the command you use to launch that editor from Git Bash.

git config --global core.editor "'C:/Program Files/Sublime Text 2/sublime_text.exe' -n -w"
git config --global push.default upstream
git config --global merge.conflictstyle diff3

Make sure you can start your editor from Git Bash

If you use Sublime, you can do this by adding the following line to your .bash_profile:

alias subl="C:/Program\ Files/Sublime\ Text\ 2/sublime_text.exe"

Restart Git Bash

You'll need to close and re-open Git Bash before all your changes take effect.

Morsel 30: Setting Up Your Workspace on Mac

Downloading necessary files

  • Save this file in your home directory with the name git-completion.bash.
  • Save this file in your home directory with the name git-prompt.sh.
  • Save bash_profile_course from the Downloadables section in your home directory with the name .bash_profile.  If you use Linux, you may need to name this file .bashrc instead of .bash_profile. (If you're curious to learn more about how bash prompts work, see this page.)

Make sure you can start your editor from the terminal

If you use Sublime, you can do this by add the following line to your .bash_profile:

alias subl="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"

Making Git configurations

Run the following Git configuration commands.  The first one will need to be modified if you are using a text editor other than Sublime, or if Sublime is installed in another location for you.  See this page for the correct command for a couple of other popular text editors.  For any other editor, you'll need to enter the command you use to launch that editor from the terminal.

git config --global core.editor "subl -n -w"
git config --global push.default upstream
git config --global merge.conflictstyle diff3

Restart the terminal

You'll need to close and re-open the terminal before all your changes take effect.

Morsel 33: Survey Says!

You can complete the survey here.

Thanks in advance!