[HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

30
© 2013 KMS Technology

description

ITviec Tech Talk HCMC, 10 August 2013 Topic: Git: Use Git to Boost Your Dev Team's Speed and Productivity Speaker: Mr. Duy Lam from KMS-Technology

Transcript of [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

Page 1: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology

Page 2: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 2

BOOST YOUR DEV TEAM’S SPEED AND PRODUCTIVITY

Duy Lam .::. Aug 2013

Page 3: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 3

AGENDA

Git Introduction Branch in Git Remote Git Git Practices

Page 4: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 4

ABOUT ME

Software Architectat KMS Technology Vietnam

[email protected] http://vn.linkedin.com/in/duylamphuong

Lâm Phương Duy

Page 5: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 5

WHAT YOU TAKE IN THE END

GitUse GitUse Git EffectivelyGit for advanced needsGit or else?

Page 6: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 6

AGENDA

Git Introduction Branch in Git Remote Git Git Practices

Page 7: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 7

VERSION CONTROL SYSTEM TYPES

Centralized Version Control System

Distributed Version Control System

Page 8: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 8

THREE GIT TRAITS#1 COMMITS ARE

SNAPSHOT

Page 9: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 9

THREE GIT TRAITS#2 WORK WITHOUT

NETWORK

Page 10: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 10

THREE GIT TRAITS#3 TWO STATES

Working Directory Git Repository

git addgit rmetc.

git commit

Git Index / Staging Area

Page 11: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 11

BASIC WORKS(DEMO)

Create new git repository Work on git staging area Update git repository Check status Undo

Page 12: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 12

AGENDA

Git Introduction Branch in Git Remote Git Git Practices

Page 13: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 13

BRANCH AND HOW IT WORKS

1 2

34

Page 14: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 14

MERGING BRANCH FAST FORWARD

git merge hotfix

Page 15: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 15

MERGING BRANCHNON FAST FORWARD

git merge iss53

Page 16: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 16

AGENDA

Git Introduction Branch in Git Remote Git Git Practices

Page 17: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 17

REMOTE URLS

Local /data/git/project.gitSSH* user@server:project.gitGit git://server/project.git

HTTP http://server/project.git

(*) Setup authentication: https://help.github.com/articles/generating-ssh-keys

Page 18: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 18

REMOTE BRANCH

Time

Page 19: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 19

REMOTE TRACKING BRANCH

a local branch associated with remote branch

> git branch --track [branch] [remote name]/[branch]

Page 20: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 20

UPDATE WITH REMOTE REPOSITORY

GET CHANGES #1

Time

git fetch origin

Page 21: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 21

UPDATE WITH REMOTE REPOSITORY

GET CHANGES #2

Time

git pull origin

master

origin/master

Page 22: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 22

UPDATE WITH REMOTE REPOSITORY

SAVE CHANGES

masterorigin/master

git.ourcompany.com

Time

master

masterorigin/master

git push origin

Page 23: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 23

BASIC WORKS(DEMO)

Create remote git repository Get new commits from remote

repository Save new commits to remote

repository

Page 24: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 24

AGENDA

Git Introduction Branch in Git Remote Git Git Practices

Page 25: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 25

HIGHLIGHT OF GIT FEATURES

(DEMO) git tag git stash git submodule

Page 26: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 26

GIT CLIENTS

http://git-scm.com: Git CLI (command line interface)

UI clients– TortoiseGit– SmartGit– SourceTree Free– Git Extensions

Page 27: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 27

GIT OR SVN ?

Git SVN

Speed of operation Faster

Data loss Less

Independent and isolated environment Yes

Access control Yes

Locking mechanisms Yes

Storage space 1/30 size

Page 28: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 28

GIT PRACTICES

Line-ending issue on platforms

Do not miss any file when committing in conflicted merge

Windows Mac & Linux

Problem \r\n \n

Solution git config --global core.autocrlf true git config --global core.autocrlf input

Page 29: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 29

GIT PRACTICES

Prefer --no-ff option on merging

Page 30: [HCM-August 13] Tech Talk on Git: Use Git to Boost Your Dev Team's Speed and Productivity

© 2013 KMS Technology 30

Thank You