<<

Git Workflow Best practices

http://git-scm.com

Anar Manafov, GSI Darmstadt ROOT Users Workshop 2013 History

patches and tarballs BitKeeper Git

Git was initially designed and developed by : “I'm an egotistical bastard, and I name all my projects after myself.”

(Git - British English slang for a stupid or unpleasant person)

2 Design

3 Design

Torvalds had several design criteria:

3 Design

Torvalds had several design criteria:

• Take CVS as an example of what not to do.

3 Design

Torvalds had several design criteria:

• Take CVS as an example of what not to do. • Support a distributed, BitKeeper-like workflow.

3 Design

Torvalds had several design criteria:

• Take CVS as an example of what not to do. • Support a distributed, BitKeeper-like workflow. • Very strong safeguards against corruption, either accidental or malicious.

3 Design

Torvalds had several design criteria:

• Take CVS as an example of what not to do. • Support a distributed, BitKeeper-like workflow. • Very strong safeguards against corruption, either accidental or malicious. • Very high performance.

3 Free and Open Source

4 Small and Fast

For testing, large AWS instances were set up in the same availability zone. Git and SVN were installed on both machines, the Ruby repository was copied to both Git and SVN servers, and common operations were 5 performed on both. Data Assurance

Every file and is checksummed and retrieved by its checksum when checked back out.

It's impossible to get anything out of Git other than the exact bits you put in.

6 Staging Area

• Staging and Unstaging Files. • Staging Patches.

7 Distributed

8 Subversion-Style Workflow

9 Integration Manager Workflow

10 Dictator and Lieutenants Workflow

11 Branching and Merging

• Frictionless Context Switching. • Role-Based Codelines. • Feature Based Workflow. • Disposable Experimentation.

12 Feature release Hot-fixes master branches dev branches Tag v1.0 Time Time line

13 Feature release Hot-fixes master branches dev branches Tag v1.0 Time Time line

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Time Time line

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release

feature for the future release Time Time line

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for the future release Time Time line

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Time Time line

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Time Time line

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Time Time line

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Start release v2.0

Time Time line Only bug-fixes

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Start release v2.0

Time Time line Only bug-fixes

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Start release v2.0

Time Time line Only bug-fixes

Tag v2.0

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Start release v2.0

Time Time line Only bug-fixes

Tag v2.0

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Start release v2.0

Time Time line Only bug-fixes

Tag v2.0

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Start release v2.0

Time Time line Only bug-fixes

Tag v2.0

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Start release v2.0

Time Time line Only bug-fixes

Tag v2.0

Tag vX.Y

13 Feature release Hot-fixes master branches dev branches Tag Major feature v1.0 for the next release Bug-fixes for v1.1

feature for Tag the future v1.1 release Start release v2.0

Time Time line Only bug-fixes

Tag v2.0

Tag vX.Y

13 Git Submodules

Main repo. ... BuildSetup.cmake CMakeLists.txt LICENSE app\... app\Tracking app\Analysis ...

Analysis repo. commit 06e0cfb51...5f3c

Tracking repo. commit b2cf03b2f...3c2a

14 Git Submodules Analysis Tracking Main Main repo. ... BuildSetup.cmake CMakeLists.txt Tag LICENSE v1.0 app\... app\Tracking Tag app\Analysis v1.1 ...

Analysis repo. commit 06e0cfb51...5f3c Tag v2.0

Tracking repo. Tag commit b2cf03b2f...3c2a vX.Y

14 more Git features

15 more Git features

• Cut off a file or files from rep. (inc. history).

15 more Git features

• Cut off a file or files from rep. (inc. history). • / Divide repos while preserving history.

15 more Git features

• Cut off a file or files from rep. (inc. history). • Merge / Divide repos while preserving history. • Cherry Pick.

15 more Git features

• Cut off a file or files from rep. (inc. history). • Merge / Divide repos while preserving history. • Cherry Pick. • Playing with commits (changing, delete, reordering, squashing, splitting).

15 more Git features

• Cut off a file or files from rep. (inc. history). • Merge / Divide repos while preserving history. • Cherry Pick. • Playing with commits (changing, delete, reordering, squashing, splitting). • You have always backups for free.

15 more Git features

• Cut off a file or files from rep. (inc. history). • Merge / Divide repos while preserving history. • Cherry Pick. • Playing with commits (changing, delete, reordering, squashing, splitting). • You have always backups for free. • ...

15 Git commands

16 Git commands

Got 15 minutes and want to learn Git?

16 Git commands

Got 15 minutes and want to learn Git?

Learn Git in your browser for free with http://try.github.com/

16