Git slide

Post on 27-Jun-2015

310 views 0 download

Tags:

description

Source Code Management with Git and Github. Nov 18, 2012. Department of Computing, Silpakorn University.

Transcript of Git slide

November 18, 2012

Source Code Management with Git & Github.comKiattisak Anoochitarom

Introduction to VCS

What is version control, and why should care ? Version Control is a system that record changes to a file or set of files over time so that you can recall a specific versions later. For the example in this class you will use software source code as the files being version controlled, through in reality you can do this with nearly any type of file on a computer.

It allows you to revert files back to a previous state, revert the entire project back to a previous state, compare changes over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more.

Local Version Control

Centralized Version Control

Centralized Version Control

Distributed Version Control

Full Mirror

Almost Everything is Local

Fast

Full Backup

Work Offline

Version Control System Software

SVN (Subversion)Mercurial (HG)

Git

FastSimpleMany branchesFully Distributed

Work efficiently with Linux Kernel

Who use git ?

3 File Status on Git

untracked unmodified modified staged

edit the file

stage the file

commit the file

add the file

remove the file

3 Stages of Git

The Basic Git workflow

1. You modify files in your working directory.2. You stage the files.3. You do a commit, files on your staging area are permanently stores in Repository.

working directory

staging area

git directory (repository)

checkout the project

stage files

commit files

Download and Install Git

http://www.git-scm.com

Basic Configuration

$ git config --global user.name “iMacbaszii” ***

$ git config --global user.email “macbaszii@gmail.com” ***

$ git config --global core.editor mate

$ git config --global merge.tool vimdiff

$ git config --list ***

$ git config user.name ***

Create Repository

Stage and Commit File

Check your files status

Log Committed History

Remove, Rename File

Demo

Github.com

Generating SSH Keys (public key)

https://help.github.com/articles/generating-ssh-keys

$ ssh-keygen -t rsa -C “macbaszii@gmail.com”

Add your SSH key to Github

https://help.github.com/articles/generating-ssh-keys

Create online Repository

Quick setup

Work with Github

It’s work.

Clone Repository

Many Open-Source Library on Github

GUI Tools

http://code.google.com/p/tortoisegit/http://www.sourcetreeapp.com

Tortoise GitSourceTree

Book Recommended

https://github.com/opendream/progithttp://www.progit.org