Git Version Control System

Post on 20-Jan-2015

1.489 views 5 download

Tags:

description

Git - Distributed Source Version Control System - The first public seminar of KMS Technology in 2013.

Transcript of Git Version Control System

Distributed Source

Version Control System

Apr 2013

Objectives

To use Git in software

project as doing with

SVN or TFS

To self study Git for

advanced needs

Confidential 3

Syllabus

Git theory

Daily development workflow

Daily collaboration workflow

More on Git

Confidential 4

Git’s history

Confidential 5

1999 2002

use patches and archived files

2005

use BitKeeper (a commercal system)

now

revoke BitKeeper, Linus Torvald

started developing Git

Source Version Control in Linux kernel project

Syllabus

Git theory

Daily development workflow

Daily collaboration workflow

More on Git

Confidential 6

Version Control Systems

Confidential 7

Centralized Version

Control Systems

Distributed Version

Control Systems

Git theory

Data = Snapshot

No network

Three states

Confidential 8

Git theory

Data = Snapshot

No network

Three states

Confidential 9

Git theory

Data = Snapshot

No network

Three states

Confidential 10

git add

git rm

git status

Syllabus

Git theory

Daily development workflow

Daily collaboration workflow

More on Git

Confidential 11

Launch Git shell

Confidential 12

Setup repository

Git in daily development

Confidential 13

git init

git clone

git add

git rm

git checkout

git commit

git status

git diff

git mv

git log

git checkout

git reset

Change repository Check repository

Undoing Update staging area

Git remote url protocols

Local /data/git/project.git

SSH user@server:project.git

Git git://server/project.git

HTTP http://server/project.git

Confidential 14

Remote repository

Confidential 15

Get remote repository

git remote add <url>

git clone git push

Get updates

git pull

git fetch

Authenticate with remote

repository

1) Generate key files with ssh-keygen

2) Upload %USER_HOME%/.ssh/id_rsa.pub to

remote repository hosting

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

Confidential 16

Syllabus

Git theory

Daily development workflow

Daily collaboration workflow

More on Git

Confidential 17

Branch (git branch)

Confidential 18

1

2 3

4

snapshot

git checkout master

Merging - Fast forward

Confidential 19

git merge hotfix

Merging - Non fast forward

Confidential 20

git merge iss53

(resolve conflicts if any)

Remote branch workflows

Create default remote branch

Get changes from remote repository

Merge changes from remote branch in

local (two methods)

Update changes to remote repository

Confidential 21

Create default remote branch

Confidential 22

Time

remote branch remote branch

Get changes from remote

repository

Confidential 23

Time

git fetch origin

Merge changes from remote

branch in local (v.1)

Confidential 24

Time

master origin/master

git merge origin/master

Merge changes from remote

branch in local (v.2)

Confidential 25

Time

master origin/master

git pull origin

git fetch

+

git merge

Update changes to remote

repository

Confidential 26

Time

master origin/master

master origin/master

git push origin/master

master

git.ourcompany.com

Remote tracking branch

• Use tracking branch to let Git know which

server and branch to push / pull

• Create remote tracking branch:

Confidential 27

> git checkout -b [branch] [remote name]/[branch]

Syllabus

Git theory

Daily development workflow

Daily collaboration workflow

More on Git

Confidential 28

Useful features

> git tag

> git stash

> git submodule

Confidential 29

Common problems

> git push

! [rejected] master -> master (non-fast forward)

Error: failed to push some refs to ‘git@gitproxy:rip747/cfwheels.git’

Confidential 30

> git pull

Merge made by recursive

> git push

To git@gitproxy:rip747/cfwheels.git

1717535..1406e8c master -> master

Common problems (cont.)

• To remove remote branch e.g origin/iss105

• Use git tag to mark releases

Confidential 31

> git push origin :iss105

Reference

For everything you want to read more about Git

http://git-scm.com

Confidential 32

THANK YOU