Version Control Systems, Git, and Github




CS175

Chris Pollett

Sep 17, 2014

Outline

Version Control Systems

Git

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

    Branches, Merging Branches

    Example resolving conflicts