Exercise 4: GitHub

Git+GitHub

Git is a popular open source, distributed source control management tool. GitHub is a popular Git repository web hosting service. You will be using both for submitting your projects for the rest of the quarter.

For this assignment, you need to publish yout first 3 exercises to a GitHub repo using Git.

How do I do this? Here's the basic idea:

Once everything is up, send me an email with the link to your class repository.

I recommend downloading & utilizing the GitHub Desktop app otherwise you can use Git on the commandline.

Due date: 4/11

Resources:

Commandline Cheat Sheet:

# print the working dir
pwd

# list the contents of the working dir
ls

# list the contents of the working dir, including hidden files
ls -a

# change directory
cd

#  change directory up one level
cd ../

# change to the user home directory
cd ~/

# change to the previous directory you were in
cd -

# make a dir
mkdir newdir

# updates the timestamp for a file or creates an empty file
touch newfile

# copy a file from one location to another
cp old/path/file new/path

# copy a folder & all it's contents from one location to another
cp -R old/path new/path

# mv a file from one place to another
mv old/path/file new/path

# rename a file (move in place)
mv file newfile

# open the current location in Finder (OSX)
open .

# open the current location in Explorer (OSX)
explorer.exe .

# open a file using the default program for that file type (OSX)
open file

# init the current folder as a git repository
git init

# add a file (& it's changes) to the current commit
git add file

# make a commit & set the commit message
git commit -m “message”

# check the current git status (what files have changed since last commit)
git status

# vi commands (default text editor opened by git for commits, etc)
ESC - exit INSERT mode
i - enter INSERT mode
:q - to quit (when not in INSERT mode)
:q! - to quit and ignore any changes made (when not in INSERT mode)
:w - to write any changes made (when not in INSERT mode)
:wq - to write any changes made and quit (when not in INSERT mode)

  1. A .gitignore file is basically just a long list of rules for what git should ignore when deciding what files have changed and what files should be added. This way you're not bothered by things which you don't want to commit. The file I'm asking you to use will ignore Xcode & Visual Studio project files as well as any app binaries that are created. _Note: the '.' in front of the .gitignore file means it is a hidden file on Unix systems (Linux/OSX/Bash, etc), which is why Finder will not show the file.