Exercise 4: 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 your first 3 exercises to a GitHub repo using Git and create a readme. A readme is a text file which explains what the software is, how it's used, and how to build it. Readmes on GitHub are generally formatted using Markdown (see Mastering Markdown GitHub guide).
How do I do this? Here's the basic idea:
- create a GitHub account
- create a new repository for this class called "CreativeCoding" on GitHub
- clone the repository to your
openFrameworks/apps
folder - move your Exercises 1-3 folders into this
CreativeCoding
folder - create a readme.md text file with:
- your name & basic info
- the class
- an entry for each exercise with a short description of what it does & if it requires any addons
- add a .gitignore file to specify while things git should not worry about1
- OSX
- open the link to this gitignore.txt file in a new tab
- copy & paste all of the text into a new TextEdit document
- make sure it is "Plain Text", if not choose Format->Make Plain Text
- save it as ".gitignore" inside the
CreativeCoding
main repo folder (make sure "If not extension is provided, use .txt" is unchecked) - it will not appear in the OSX Finder after (this is fine)
- Windows
- download this gitignore.txt file using Right+Click "Save as"
- place it in the main
CreativeCoding
folder - rename it "gitignore.txt" to ".gitignore." (note the trailing period)
- OSX
- add the .gitignore file
- add the files & folders for these projects, double check that only the src & bin/data folders for each project are listed when running
git status
as you don't want to add the project files or temporary build files - add the readme
- commit
- push to GitHub
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.
Resources:
- Git
- GitHub
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 (Windows)
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 "did this and did that"
# 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)
-
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. ↩