Project Workflow

Objective: practice using Bash and Git commands within in a workflow that is fundamental to this class

Working with Bash

Please see the tutorial here

Working with Git

Please see the tutorial here

For further instruction:

We will be using git and GitHub to manage all of our code and documentation throughout the course. During the online portion of this class you were exposed to some of the basics of git and GitHub. If you would like a refresher, check out the link below:

https://guides.github.com/activities/hello-world/

In order to collaborate within teams and across different hardware platforms (i.e. laptops, drones, etc), we will need to use some of the intermediate/advanced tools within git/GitHub, particularly forking remote repositories. Our goal is to make these tools as easy to use as possible.

The course instructors will distribute account names and access to teams.

Warning:

Each member of each team should memorize the team’s GitHub account password so everyone has access. The passwords should NOT be documented else their is a risk of someone else gaining access to your account.

Laptop Repository Setup

We are going to start by cloning and configuring the laboratory repo on the team laptops. Similar instructions can be used to configure the repo on your own personal laptops. The goal is to configure laboratory such to have an upstream remote repo to access new code provided by the instructors, as well as an origin remote repo where your team collaborates on new code.

Start by cloning the public repository that the instructors manage

cd ~/bwsi-uav
git clone https://github.com/BWSI-UAV/laboratory.git

This remote repo starts as your origin but we are going to reconfigure it to your upstream remote repo

cd ~/bwsi-uav/laboratory
git remote add upstream https://github.com/BWSI-UAV/laboratory.git

Now you need to create your team’s own laboratory. Go to github.mit.edu on the team laptop with your team’s Github account. Make a new private repository titled laboratory and copy the remote repository URL found here, making sure to select SSH: copy-remote-repository-url-quick-setup.png

Go to the SSH’d terminal window and type the following commands:

cd ~/bwsi-uav/laboratory
git remote set-url origin <remote repo URL, pasted>
git remote -v

You should see both an upstream and origin remote repo (each has two entries: fetch and push)

Testing Repository Setup

We will now test that you have configured your drone directories and repositories correctly

  1. Instructors: push a new file called git_hello_world.md to https://github.com/BWSI-UAV/laboratory/tree/master/project_workflow

  2. Research Specialist: on the team laptop, and navigates to the laboratory repository.

  3. Research Specialist: pulls the new file with git pull upstream master. Open new file and add one line of text. Example: “Hello! this is the (team name) team! My name is (your name), today’s research specialist!”

  4. Research Specialist: commit changes to git_hello_world.md locally on team laptop

  5. Team Members: In sequence each team member uses the team laptop, opens git_hello_world.md, adds another line of text (e.g. “Hello this is (your name)!), and commits. At this point their should be 5 new lines in git_hello_world.md.

  6. Research Specialist: On the team laptop, push new commits to git_hello_world.md to your team’s laboratory with git push origin master

  7. Team Members: In sequence each team member pulls the new commits to their own laptops with git pull origin master, modifies the file again to add another line (totaling 10 new lines from the start of the exercise), commits, and pushes back to team’s repository

Stretch Goal: Merge Conflicts

If time permits, we will also practice resolving conflicts in git.

  1. Instructors: introduce a change to git_hello_world.md

  2. Software Specialist: on personal laptop, attempt to pull upstream change to git_hello_world.md with git pull upstream master. Git will inform you that a conflict has occured

  3. Team: In 20 minutes, see if you are able to resolve the conflict without help from instructors. A successful resolution will create a file with all of the teams additoins as well as the instructors additions

[ ]: