Homework 1.4: Using Git/GitHub to submit this homework (15 pts)
This may be your first time using Git/GitHub. Git is a version control system that allows for collaborative work. GitHub is a website that can host Git repositories. We will be using Git/GitHub exclusively for submitting homework and tutorial exercises. We do this for two main reasons. First, this allows for much easier tracking, submission, and grading of homework. Second, and most importantly, you should be using version control when working with real data. It is good practice both for the security of your own work and for reproducibility of your research.
Prior to submitting this homework, you formed a team of three (and possibly four) people. This team has a repository containing your work for this class that is hosted at GitHub. For example, if you are team number 6, your repository is hosted at https://github.com/bebi103/06-bebi103a-2021
. The rest of this problem is written as if you are team 6, but you can make obvious substitutions for your team.
a) Clone your repository to your machine. I like to keep my repositories in the directory ~/git
, but the location on your machine is your choice. To clone into that directory, I would do the following on my machine on the command line. (You can get a command prompt by launching a Terminal using the JupyterLab launcher.)
cd ~/git
git clone https://github.com/bebi103/06-bebi103a-2021.git
b) Upon cloning the repository, you will have a new directory, ~/git/06-bebi103a-2021
containing your team’s repository. Within that directory, you will see three subdirectories, homework/
, tutorial_exercises/
, and sandbox/
. The homework/
and tutorial_exercises/
directories are for submitting homework and tutorial exercises. The sandbox/
directory is for messing around with various ideas that are not for serious submission.
You will need to create a directory on your local machine within the repository called data/
. For my machine, I would do
mkdir ~/git/06-bebi103a-2021/data
This directory is not under version control, and anything you put in there will not be uploaded to GitHub. This is because we do not want to have large data files under version control. Git will automatically ignore the contents of this directory because it is included in the .gitignore
file of the repository.
Though you do not need any data for this homework submission, when you do download data sets for use in your homeworks, they go in the data/
directory.
c) You will place the solution to this homework problem in the file homework/hw1.4.ipynb
. One of your team members should create this file. After it is created and saved, he or she can add it, commit, and push.
cd ~/git/06-bebi103a-2021/homework
git add hw1.4.ipynb
git commit -m "Initial commit of homework 1.4."
git push origin main
d) Now, the other members of your team should pull the updates.
git pull
Each team member should, in turn on their own machine, write a haiku about data analysis in a Markdown cell, save the notebook, add it, commit, and push. (Don’t put too much time or thought into the haiku; it’s just for fun to add some text.) Something like this:
cd ~/git/06-bebi103a-2020/homework
git add hw1.4.ipynb
git commit -m "Justin added his haiku. It's undoubtedly bad."
git push origin main
As you are working through your notebooks, it is wise to commit and push often. Before you start working, you should also pull to get your teammates’ changes. To avoid conflicts, you may want to edit notebooks separately and then copy and paste them into the notebooks you will submit at the end. These other notebooks should be in the sandbox/
directory to keep your homework/
directory clean. More experienced Git users can use branches and merges instead.
e) After you have completed the other problems in files homework/hw1.1.ipynb
, homework/hw1.2.ipynb
, and homework/hw1.3.ipynb
, along with your haikus in homework/hw1.4.ipynb
, it is time to submit the homework. To do this, commit and push your final submission. Something like this.
cd ~/git/06-bebi103a-2021/homework
git add hw1.*.ipynb
git commit -m "Final commit for homework submission."
git push origin main
Then, follow the instructions here to tag this commit as the homework submission. When you type the version number of your release, use hw01_submission
. You do not need to include any binaries or select anything about pre-releases.