Version Control, Git, Github




CS174

Chris Pollett

Oct 24, 2016

Outline

Bonus Interview Question

Purpose: Second chance at course learning outcomes from the midterm. Successful completion of bonus is worth half back for the points you lost on the midterm.

Due Date: Dec 12 before office hours over.

Description: Write a PHP program, present it to me, and answer questions about it during my office hours on my white board without notes. Your program should read into an array of lines, $lines, every kth row of file foo.txt in the current working directory. Here k should be a define to the 5th digit of your student id. Your program should take the $_REQUEST['foo'] variable and check if it is a string. If it is a string, it should insert the tuples ($line, $_REQUEST['foo']) for each $line in $lines into a mysql table FOO using a prepared statement.

Version Control Systems

Git

Quiz

Which of the following statements is true?

  1. The PRG design pattern is used only when data is "get'd" from a form.
  2. To declare a new namespace, the module keyword is used.
  3. You cannot instantiate traits in PHP.

Quiz

Which of the following statements is true?

  1. To declare a new namespace, the using keyword is used.
  2. You can instantiate traits in PHP.
  3. The PRG design pattern is supposed to keep the back button working when data is posted from a form.

Example Creating a Repository

  • Here is a short example of creating a repository on a *nix system in the directory /Users/cpollett
    mkdir myrepos
    cd myrepos
    git init
    git add .
    echo "hi there" > test.txt
    git add test.txt
    git commit -a -m "Initial commit"
    cd ..
    git clone file:///Users/cpollett/myrepos myrepos2
    cd myrepos2 # now start editing myrepos2
    echo "test2" > test2.txt
    git add test2.txt
    git commit -a -m "Made some changes"
    cd ../myrepos #now want to get changes back in myrepos
    git pull file:///Users/cpollett/myrepos2 master
    
    This produces a copy of the repository in a separate folder. We then edit the copy, and pull the changes back (the changes were in the clone's master branch) into the original repository. We will describe git add and git commit in a moment.
  • If in myrepos2 we had want to get changes from myrepos, we could simply have done:
    git pull
    
    as git will default to pulling where it was cloned from.
  • Creating a WebDav repository

    Configuring your Repository

    Adding, Moving Files