You do not have to pull first, but it is a good idea in case anyone has pushed before you have a chance to.

Remove the main repo and go about your business

$ cd ../../../

$ rm -rf workshop/

Using Git/Github: The basics

Cloning an existing project:

For every assignment, you will need to clone the project repository You should only do this once per repository per computer. After you clone, the project directory will be downloaded onto your computer and all future git changes must be made inside that directory.

use the following command to checkout:

$ git clone https://github.com/mks65-dw/<assignment name>.git

Cloning into 'hw1'...

remote: Counting objects: 4, done.

remote: Compressing objects: 100% (3/3), done.

remote: Total 4 (delta 0), reused 0 (delta 0)

Unpacking objects: 100% (4/4), done.

for example, to checkout an assignment called hw1 I would do the following:

$ git clone https://github.com/mks65-dw/hw1.git

Cloning into 'hw1'...

remote: Counting objects: 4, done.

remote: Compressing objects: 100% (3/3), done.

remote: Total 4 (delta 0), reused 0 (delta 0)

Unpacking objects: 100% (4/4), done.

This will create a folder on your computer called (in this case) hw1. You must go into that folder to add your own directory.

Creating your own directory within a project:

Once you have cloned the assignment, create a directory for yourself. Change into the assignment folder and make a new directory with the name: Firstname_Lastname. So mine would be JonAlf_Dyrland-Weaver. After you create the directory add it to the main repository and commit (see the instructions for adding and committing below)

So to make my own repository to the project called hw1 from above:

$ cd hw1

$ mkdir JonAlf_Dyrland-Weaver

$ cd JonAlf_Dyrland-Weaver

Once you make, add and commit the directory do all your work within the directory

Adding files:

When you create a new file, it is not automatically tracked by git. You must tell git which files it should track. (This is useful because you don't want to add .o, ~ and executable files that may get created while working on your project, you may also look at .gitignore for more ways to keep out unwanted files). You only need to do this once per file. After it has been added git will track it. You cannot add an empty folder. Make sure you put something in a folder in order to add the whole thing

$ git add file.txt

You will not see any response after adding a file

Removing files:

$ git rm file.txt

rm 'JonAlf_Dyrland-Weaver/file.txt'

Running git rm will also remove the file from your directory immediately

Committing your changes:

When you add files, the changes are not automatically saved but git, you must commit these changes. You must always use the -m option followed by a string containing a commit message. You should commit anytime you have changes that are worth saving!

$ git commit -a -m "adding an initial file"

[master 5524096] adding an initial file

0 files changed

create mode 100644 JonAlf_Dyrland-Weaver/file.txt

The -a option will automatically commit any changes to files that you have already added. You should always include -a (unless you know what you're in for)

Pushing your changes to gihub

Committing is a local operation, it will not change the status of your work on gihub. You do this with the push command. When pushing, git may ask you for your username and password, (use your github account information) depending on how you have git set up.

$ git push

Username for 'https://github.com': jonalf

Password for 'https://jonalf@github.com':

To https://github.com/mks65-dw/hw1.git

8bd554d..5524096 master -> master

Updating your project to the latest version:

When you start working in a new location (i.e. you worked in school, pushed your changes and now want to work at home with the latest version), pull any changes from github. This will make all of your files match with those on github.