Version Control, Git




CS174

Chris Pollett

Apr 3, 2017

Outline

Version Control Systems

Git

Quiz

Which of the following statements is true?

  1. A constructor for a class in PHP is defined in a method builder().
  2. Classes in PHP can extend multiple parent classes.
  3. A class in PHP can use multiple traits.

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

    Committing changes

    We continue to look at how to manage versions of a project in git.

    Branches, Merging Branches

    Example resolving conflicts

    Making patches