Homework 9: Git-ing Started
This homework is worth 10 points.
Goals
When you finish this homework you should:
- understand the purpose of software version control.
- have created a Github account.
- have created a repo for a small project.
- have uploaded code to a repo.
- have downloaded code from a repo.
Assignment
Please note, this is a crash course in getting started. This just touches the surface of what can be done with git and using github. I do not regularly use git at this point, so there may be more efficient ways to do things.
The background material for this assignment is available here. You can read the selected chapters, or watch the videos if they exist. There are many other sources of documentation.
Do the following tasks. Please read the entire step before starting on the step.
- Setup and Background
- Create an account on github.
- You may skip this step if you already have a github account.
- You may skip this step if you are opposed to creating such an account.
- A free public account will be fine for this class and probably most of your use for a while.
- Read chapter 1.1 Git Basics, or watch the video.
- If you will be installing git on your home machine, go over 1.5 Getting Started - Installing Git
- It appears git is installed on all of the linux machines.
- But you might want to install it at home.
- You probably want to read 1.6 Getting Started - First-Time Git Setup
- Setting up a repo for an existing project
- We will assume that you have an existing project you want to set up a github repo to maintain the project
- Starting from scratch you might let github do some of the steps for you.
- Look at these Instructions. I will step through them.
- Create a new project.
- On the local machine make a directory (Hello)
- In this directory
- Make Hello.C a program that prints "Hello World!"
- Make a Makefile to build it.
- Create a new repo on Github. I called mine "HelloWorld"
- Modifying the project
- You can now go to the web page for the repo and edit files.
- Click on the file name and look at or edit.
- Add a new line to your "README.md"
- Or create a new file
- Create a LICENSE file and add the GPL
- Downloading the changes on the local machine
- Back on the local machine, in your project directory.
- git pull
- This will bring down a copy of any new or modified files.
- Edit Hello.C and add a comment.
- Check the status of your repo git status -s
- This should note that Hello.C has been modified.
- Push the new file to the repo
- Mark Hello.C as something you want to update
- Commit it to the local repo
- git commit -m "Comments to Hello.C"
- Push it to github
- Refresh the browser and see that it is there.
- Add a new file.
- Create messages.C and messages.h to provide other messages.
- Check the status
- git status
- Note that messages.h message.C need to be included in the project.
- Mark these as part of the project.
- git add messages.h messages.C
- you probably edited other files as well, so mark them for update
- And update the entire repo
- git commit -m "expanded for new messages"
- git push
- Grab a copy of a different repo.
- Make a copy of my HelloWorld repo
- move to the directory where you want this work to appear.
- git clone https://github.com/danbennett360/HelloWorld
- Smile.
You can now
- Have a working copy of your software anywhere. (just git clone)
- Give copies of your software to anyone (just send the url)
- Have groups work on a project, but there is some additional work needed.
- Have reasonable documentation and a supporting wiki.
But be aware everyone has access to this software.
- You probably do not want to put up most homework.
- You probably only want to put up quality code,
- That is the point of this exercise, make a portfolio for future employers.
Submission
Email a message to your instructor containing the following
- A subject that says CSCI 311, Homework 9.
- A statement that you have read the material and worked through this exercise.
- Include a link to your Hello World project repo or a statement to the effect that you do not wish to create a public github account.