π» Week 10 - Lab Roadmap (90 min)
DS105 - Data for Data Science
If you want to gain time, try to do the following before you attend the lab on Friday:
- Create a dedicated Github repository for your project. Give this repository a meaningful name and add your team members as collaborators.
Lab Roadmap
By the time of this lab you have (hopefully) already decided on the topic of your group project and (most likely) are eager to start writing code. Yay! We knew that!
For you to collaborate efficiently on your project you will need to understand the basics of GitFlow and generally managing projects on GitHub.
Today we will go through some steps that will help you better understand how data science projects work.
Part 1: Setting up a GitHub repo (10 min)
Part 1: Setting up a GitHub repo
The first thing that you should do (if you havenβt done so yet) is to create a repo for your project on GitHub. You will store your code there.
π― ACTION POINTS
- Move around and sit together with the members of your group.
You might have taken the next steps already. But make sure you have done it.
- (IF YOU HAVENβT DONE SO YET) One of your group members creates a private repo on GitHub with the name of your project. Make sure to add a README file.
- Go to your repo -> Settings -> Collaborators -> Add people. Add all the members of the project to the repo.
- Clone the repo to your Desktop.
Now you have the repo with all the members having access to it.
Part 2: Letβs grow a tree (40 min)
Part 2: Letβs grow a tree
One of the key principles of GitFlow is creating branches. Branches are used to separately work on a certain feature or fix a problem.
Letβs create some branches and make sure we understand how to work on them.
π€ WORKING TOGETHER
- Each group member creates an issue to create a file with their information there. Name each issue according to the name of the person whose information we need there. For instance, if Antonβs information is needed it will be
Add Anton's info
. - Once the issue is created it will be assigned a number.
- Each of the group members creates a new branch and calls it in the following format
issue#N-username-description
, where:- N is the number of the issue
- username is the personβs GitHub username
- description is a very short description of whatβs done in this branch
issue#1-antongithub-add-info
Once the branch is created each of you can work inside of those branches without changing the main repo.
π― ACTION POINTS
- Switch to your branch.
- On your branch create a file called
username.txt
whereusername
is your GitHub username. - Add some information about yourself to the file.
- Commit and push the file to your branch.
Part 3: You shall not pass (10 min)
Part 3: You shall not pass
Once you have pushed some changes to your branch you can send them to the main repo. It will thus become a part of your project.
This is managed using such things as pull reqests. Letβs take a look at how they work.
π― ACTION POINTS
- Go to GitHub (the website).
- Open the Branches tab.
- Find the branch you have been working on and click New Pull Request.
- Describe what you are adding to the project.
- Assign your group mates as reviewers.
- Create the pull request.
- Ask another team member to merge the pull request.
Voila! You have the files on your main branch!
Part 4: If I ignore it, it will go away (15 min)
Part 4: If I ignore it, it will go away
When it comes to sending files to GitHub you would want to upload various types of files there. For instance, you would avoid uploading your data because itβs too big and GitHub limits your space. Or, you would avoid sending some sensitive or private information to your repo such as private keys and/or passwords.
To accommodate that while also keeping those files locally we use .gitignore
. They stop your machine from sending files to GitHub. Letβs explore how it works.
π― ACTION POINTS
- Create a folder in your repo called
data
and store 5 random files there. - Using VS Code create a file called
.gitignore
in your repo. - Add the name of the folder to your
.gitignore
file. - Try to push everything to your repo. Has your repo changed?
- Create a file called
VERY_SECRET_KEY.txt
and save some random numbers and letters there. - Add the name of the file to
.gitignore
. - Try to push everything to your repo. Has your repo changed?