This lab exercise will familiarize you with some more features of git.
You will need to sign in to https://git-classes.mst.edu and clone the repository for this lab.
Your repository will be named something along the lines of
2017FS-<section>-lab03-<username>1. Make sure to
clone with the HTTPS URL (unless you’ve set up SSH keys).
Feel free to consult with your favorite search engine, relevant
pages, the lab instructor and assistants, and your fellow labmates
when you need help.
Just make sure that what you turn in is your own work!
Jake the Dog created a git repository for the filter program from Lab 2. He wants to collaborate with you to add some features to it.
Remember how it’s bad practice to commit generated files to a
repository? Well, Jake managed to add
a.out anyway. Oops.
git rmto delete
a.outfrom the repo.
git statusto see what this change looks like.
.gitignorefile that ignores
.gitignoreto the repository and commit.
Note that your commit in step 4 should commit two changes:
Jake has added another feature: ignoring whitespace at the start of
lines. Now, your program can filter lines that contain whitespace
(tabs and spaces) before a
Jake is very busy at the moment, so you’ll
have to help him merge his feature into
git checkoutto check out Jake’s branch (named
git diff masterto see exactly what Jake changed in
git checkoutto check out the master branch.
git merge whitespaceto merge Jake’s branch into the current branch (
git statusto find out which file is causing the conflict.
git addand commit them with
Okay, so now you’ve got the repository cleaned up!
Jake wants you to add a new feature to the filter program. Instead of
hard-coding the comment character as
#, he would like to be able to
specify the comment character on the command line.
He wants to be able to do something like….
cat story.txt | filter %
… to filter lines that start with a
filter.cpp, so that it behaves as described. Stage your changes, then commit. (Too easy? Try using
pusha new branch, you have to tell git to make a new branch on the remote. When you run
git push, it will tell you the right command to run.
Alrighty! Now that your new feature is done, let’s merge it into master.
Jake realized that he deleted a section of the header documentation
git revertto undo that mistake!
Your repo on gitlab is your submission, so whatever is up there is what we will grade. Make sure you’ve pushed both your feature branch and master. You can double-check on the Gitlab website to make sure your submission looks the way you want it to.
We expect to see the following files on the
git help <command>to learn more about a command.
git help committo learn about
<section> is your section (
<username> is your username. ↩