Git




CS174

Chris Pollett

Oct. 6, 2010

Outline

Git

  • When we introduced version control systems we said we were going to consider one system based on the central repository model (Subversion) and one distributed system (Git).
  • Git has been around since 2005, and was originally developed by Linus Torvald, the creator of Linux.
  • Git has a nice website for publically hosting git repositories known as GitHub. Repositories on this sites get their own issue tracker (with rss feed) and wiki.
  • Git uses many commands in a similar way to svn; however, there are some key differences which we will see as we go along.
  • To begin to set up a git repository move to where you would like to have your repository and type:
    git init name_of_git_repository.
    
  • If you cd into this directory and do an ls -a to see hidden files, you will see a .git folder.
  • This is where git keeps track of stuff, unlike svn, each subfolder of your repository doesn't get a .git folder -- svn allows you to check out sub-folders of a repository, with git you essentially always check out a whole everything in a whole branch.
  • If you want to let someone to get a copy of your repository, you copy the repository folder on to a usb key (a key without Stuxnet please), give it to the person you want to have the repository.
  • The person that wants to get your repository, might have an existing repository that they want to get your stuff into or might be starting from scratch. They issue a commands like:
    git clone path_to_clone_from to_folder #from scratch case
    git pull path_to_from_repos branch_name_you_want_to_pull_into #existing case
    git checkout branch #makes branch the current branch in the repository you are working on
    
  • Notice sharing can be done locally without the need for a central repository, you can zip your git folders and e-mail, git even has its own e-mail commands.
  • To see information about git commands, you can type 'git help', or 'git command --help'
  • Configuring your Repository

    Adding, Moving Files

    Committing changes

    Branches, Merging Branches

    Making patches, final comments