git, a new source code management system (scm) after cvs and svn

35
1 Git, a new Source Code Management system (SCM) after CVS and SVN Based on the work of Christophe Demarey, Julien Vandaele Research Centre INRIA Lille – Nord Europe Claire Mouton Foudil Brétel Atelir Git – October 17 th 2013

Upload: prem

Post on 08-Jan-2016

50 views

Category:

Documents


1 download

DESCRIPTION

Git, a new Source Code Management system (SCM) after CVS and SVN. Claire Mouton Foudil Brétel Atelir Git – October 17 th 2013. Based on the work of Christophe Demarey, Julien Vandaele Research Centre INRIA Lille – Nord Europe. Core Notions. Core notions > Get a project. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Git, a new Source Code Management system (SCM) after CVS and SVN

1

Git,a new Source Code Management system (SCM) after CVS and SVN

Based on the work of Christophe Demarey, Julien Vandaele

Research Centre INRIA Lille – Nord Europe

Claire Mouton Foudil Brétel

Atelir Git – October 17th 2013

Page 2: Git, a new Source Code Management system (SCM) after CVS and SVN

2

Core Notions

Page 3: Git, a new Source Code Management system (SCM) after CVS and SVN

3

Core notions > Get a project

checkout / clone

Repository

Developer A

Developer B

Page 4: Git, a new Source Code Management system (SCM) after CVS and SVN

4

Developer A

Developer B

Core notions > Commit

development

Repository

Page 5: Git, a new Source Code Management system (SCM) after CVS and SVN

5

Core notions > Commit

commitDeveloper A

Developer B

Repository

Page 6: Git, a new Source Code Management system (SCM) after CVS and SVN

6

Core notions > Update

Repository

Developer A

Developer B

update

Page 7: Git, a new Source Code Management system (SCM) after CVS and SVN

7

Core notions > Conflict

Repository

Developer A

Developer B

commit

Page 8: Git, a new Source Code Management system (SCM) after CVS and SVN

8

Core notions > Conflict

Repository

Developer A

Developer B

commit

Page 9: Git, a new Source Code Management system (SCM) after CVS and SVN

9

Core notions > Conflict

Repository

Developer A

Developer B

merge

conflict

Page 10: Git, a new Source Code Management system (SCM) after CVS and SVN

10

Core notions > Conflict

Repository

Developer A

Developer B

diff

conflict

Page 11: Git, a new Source Code Management system (SCM) after CVS and SVN

11

Core notions > Conflict

Repository

Developer A

Developer B

commit

Page 12: Git, a new Source Code Management system (SCM) after CVS and SVN

12

Core notions > Branch

• Maintenance and development (maintain version N and develop version N+1)

• Work on a project sub-set (one

branch per feature)

• Experimental development

• Save commits temporarilynew

branch

mainbranch(trunk)

branch

Page 13: Git, a new Source Code Management system (SCM) after CVS and SVN

13

Core notions > Branches merging

merge"Merge branches" :

Bring changes from a branch to another branch

newbranch

mainbranch(trunk)

Page 14: Git, a new Source Code Management system (SCM) after CVS and SVN

14

Centralized SCM> CVS and Subversion (SVN)

Page 15: Git, a new Source Code Management system (SCM) after CVS and SVN

15

Conclusion on centralized SCM

A central/core repository

Easy to use

Parallel work (merge) is difficult No memorizing of successive merges information The user has to remember! (to avoid conflict while merging)

Need to be on line for almost commands

Privileged users (committers)

CVS SVNDistributedSCM (Git)

past present future

Page 16: Git, a new Source Code Management system (SCM) after CVS and SVN

16

Distributed SCM

Page 17: Git, a new Source Code Management system (SCM) after CVS and SVN

17

Policy example: centralized

Page 18: Git, a new Source Code Management system (SCM) after CVS and SVN

18

Policy example: distributed

Page 19: Git, a new Source Code Management system (SCM) after CVS and SVN

19

Decentralized benefits

• Each developer can have his own repository• Off-line use (commands available offline)

– ex: Do a local commit

• Create a branch without having to ask authorization– ex: Open Source community

• Synchronisation needed between repositories• pull = get changes from a remote repository to your local repository

• push = post your changes to a remote repository

Page 20: Git, a new Source Code Management system (SCM) after CVS and SVN

20

Exchanges between (remote) repositories

pushpull

pushpull

pull push

pull

pull

push

push

Page 21: Git, a new Source Code Management system (SCM) after CVS and SVN

21

Decentralized SCM> Git

Page 22: Git, a new Source Code Management system (SCM) after CVS and SVN

22

Git > History

Goal: manage efficiently big projects like "Linux"

Use of Git for the Linux kernel since june 2005

April 2005

Linus Torvalds Matt Marckall

Page 23: Git, a new Source Code Management system (SCM) after CVS and SVN

23

Git > Local operations

commit

master

topic

Main line

Newbranch

Current line

Git user

Page 24: Git, a new Source Code Management system (SCM) after CVS and SVN

24

Git > Conflict

commit

master

topic

conflictresolution

Git user

Page 25: Git, a new Source Code Management system (SCM) after CVS and SVN

25

Git > Distant operations

master

origin

clone

master

pullfetch merge

cherrypick

=+

Remote machine

Local machine

Page 26: Git, a new Source Code Management system (SCM) after CVS and SVN

26

Git > Workflow

A

B

1. clone

2. commit

3. push

> Classic working

Page 27: Git, a new Source Code Management system (SCM) after CVS and SVN

27

Git > Workflow

A

B

1. clone

2. commit

3. push

A

B

1. pull

2. commit

> Classic working

3. push

Page 28: Git, a new Source Code Management system (SCM) after CVS and SVN

28

Git > Bisection

badgood

? ? ?

Finds the commit introducing a bug by dichotomy

Page 29: Git, a new Source Code Management system (SCM) after CVS and SVN

29

Git > Bisection

badgood suspectsuspect

Finds the commit introducing a bug by dichotomy

Page 30: Git, a new Source Code Management system (SCM) after CVS and SVN

30

Git

Good visualization and branch handling, available locally:

saving of intermediary states, working on distinct features, experiments, …

Easy merge of branches, cherrypick for one single commit

All operations available locally, except push and pull

Flexible: undo / modify commits, locally before sharing

Hooks pre/post (commit, update ...)

Bisection: finds the guilty commit (the one that introduced the bug)

Efficient on big projects

Available on Linux, OS X and Windows

Page 31: Git, a new Source Code Management system (SCM) after CVS and SVN

31

Around Git

GUIs• qgit (Qt)

• TortoiseGit via Putty (Windows)

• GitX (MacOS)

• Gitk (Windows, Linux, MacOS)

UsersLinux kernelWineX.orgAndroidKitware

Useful links• http://git-scm.com/

Page 32: Git, a new Source Code Management system (SCM) after CVS and SVN

32

Around Git > qgit

Page 33: Git, a new Source Code Management system (SCM) after CVS and SVN

33

Conclusion

Page 34: Git, a new Source Code Management system (SCM) after CVS and SVN

34

Conclusion

• A decentralized SCM remains a tool• No default usage policy

• Policy to be defined– From centralized to decentralized– Pull-only vs shared-push

Anarchic Centralized Linux kernel modelBranch by functionality

orRelease train

Page 35: Git, a new Source Code Management system (SCM) after CVS and SVN

35

Conclusion

• A decentralized SCM remains a tool• No default usage policy

• Policy to be defined– From centralized to decentralized– Pull-only vs shared-push

Centralized-style workflow Integration manager workflow