git 101 for_tarad_dev

Post on 15-Jan-2015

277 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

1

Git 101

2013/03/12@somkiat

2

Why Version Control ?

3

Why Version Control ?

Collaboration issues !!!

4

Version Control

• Local• Centralize• Distributed

5

Local

http://git-scm.com/book/en/Getting-Started-About-Version-Control

6

Centralize

http://git-scm.com/book/en/Getting-Started-About-Version-Control

7

Distributed

http://git-scm.com/book/en/Getting-Started-About-Version-Control

8

Version Control

• Local– Copy file and folder

• Centralize– Control Version System ( CVS )– Subversion ( SVN )

• Distributed– Git– Mercurial Hg– Bazaar

9

Why Git ?

1. Distributed => No Single of Failure

10

Why Git ?

2. Simple design :: Less config file

VS

11

Why Git ?

3. Speed :: Work on local

From git real slide ( http://www.codeschool.com )

12

Who use Git ?

http://git-scm.com/

13

Starting with Git

• Command line interface• Many Graphic User Interface (GUI)• Download at http://git-scm.com

14

Git Help

$ git help

15

Git Help

$ git help <command>

16

Git Setting

$ git config <name> <value>

• $ git config --global user.name “Your name”• $ git config --global user.email “Your email”• $ git config --global color.ui true• $ git config --list

17

Starting your repository

$ git init

18

Starting your repository

$ git init

19

Git work flow

http://git-scm.com/book/en/Getting-Started-Git-Basics

20

Git work flow

• Create file README.txt– Start as untracked

• Add file to staging area– Ready to take a picture

• Commit change– Snapshot on the stage

21

Create file README.txt

$touch README.txt$git status

New file and untracked

22

Add file to staging area

$git add README.txt$git status

Staged file

23

Commit change

$git commit –m “Create file README.txt”$git status

Working on branch master

24

TODO

• Modify file README.txt• Create file LICENSE• Add both files to staging area• Commit change

25

Different way to add

• git add <list of file>• git add –all• git add *.txt• git add docs/*.txt• git add docs/• git add “*.txt”

26

Git timeline history

$git log

History message

27

Homework

• Learn git with github.com– http://try.github.com/

28

Next

• Git merge• Git branch• Collaboration – Git remote• Branch• Tag

• Git rebase• History and configuration

top related