Git Started

Say you’ve got a URL to one of our GitHub homework repositories, e.g. https://github.com/DS385Fall22/hw01-roualdes. You should have access to such a private repository for each specific assignment within your GitHub account. Submitting an assignment will generally follow these steps: copy the assingment from the GitHub repository, edit files, and push the files back up to the assignment’s repository. I will then grade your assignment from your repository.

With a working installation of git on your machine, you will generally follow these steps from within a (git) bash terminal where

$ git --version

successfully returns a version number for git and specifically with no error message.

$ cd ~/...wherever.../math385/homework/

This will copy the entire repository (directory on GitHub) to your current working directory $ pwd. Be sure you’re in a reasonable directory before executing the below command.

$ git clone https://github.com/DS385Fall22/hw01-roualdes.git
# this is my repository for HW01, you need to find your own for each assignment
$ git status

For reasons we won’t explain in this class, before you can finalize your edits we must stage the files we wish to push. Assume you want to submit the file hw.ipynb. To stage this file execute

$ git add hw.ipynb

You need to call this command for each new file you want to add. \

NB If, in this step, I find that you are taking shortcuts that make my life more difficult I will subtract points from your homework assignment.

Check the status after adding a file.

$ git status

Commiting some changes to your local git directory is the formal way to lock in some edits (locally).

$ git commit -m "a short message describing the edits goes here in quotes"

Check the status after commiting a file.

$ git status

Pushing to your remote repository (the one I can see on GitHub) is the formal way to lock in some edits (remotely).

$ git push

You can confirm that your homework was properly submit by viewing the GitHub repository online. The repository we’ve been working with is located at https://github.com/DS385Fall22/hw01-roualdes, which you won’t be able to see because it’s private. It’s highlighted here so you can see that it’s nearly the same link as the one we cloned from.