The goals of this lab are to:
Git is a large piece of software, and there is a lot to learn with git. Fortunately, it is easy to get up and running on git with just a small number of commands.
git clone git@github.swarthmore.edu:CS35-s17/lab00-<user>.gitwhere <user> is your username.
This might seem like a lengthy sequence of commands to remember, but don't worry! We'll go over this in lab next week, and the commands will be the same for each assignment during the semester.
$ clang++ -o greeting greeting.cpp
Then, execute your compiled program. You might see something like:
$ ./greeting
I am a computer greeting program.
What is your name? Joshua
Hello Joshua, it is nice to meet you!
$ clang++ -o guess guess.cpp
A sample run of your program might look like:
$ ./guess
Please guess a number between 1 and 10. 12
Please guess a number between 1 and 10. 0
Please guess a number between 1 and 10. -4
Please guess a number between 1 and 10. 6
You guessed: 6. That's the right number.
Good job!
You can assume the user will enter an integer, but don't the
user enters an integer in the proper range.
$ git add greeting.cpp guess.cpp
The git add step adds modified files to be part of the next commit
to the github server.
$ git commit -m "completed lab0"
The git commit step makes a record of the recently added
changes. The -m "completed lab0" part is a descriptive message
describing what are the primary changes in this commit. Making a
commit allows you to review or undo changes easily in the future,
if needed.
$ git push
The git push command sends your committed changes to the github
server. If you do not run git push before the submission deadline,
the instructor will not see your changes, even if you have
finished coding your solution in your local directory.
If you make changes to files after your push and want to share
these changes, repeat the add, commit, push loop again to update
the github server.
To recap, the git commit cycle is git add, git commit, git
push. Don't forget to git push when you have completed an
assignment.
You can review the basic git commands on
the github
help pages. Eventually, you should get in the habit of
using git
status to see if everything has been published, but we will
talk about this more throughout the semester.
Once you are satisfied with your code, hand it in via git. Remember to add, commit, push. You may commit and push as often as you like, and only the most recent push will be graded.