versioning commits and patches with git-series

105
Versions all the way down Versioning commits and patches with git-series Josh Triplett [email protected] LinuxCon North America 2016

Upload: doandat

Post on 14-Feb-2017

236 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Versioning commits and patches with git-series

Versions all the way downVersioning commits and patches with git-series

Josh [email protected]

LinuxCon North America 2016

Page 2: Versioning commits and patches with git-series
Page 3: Versioning commits and patches with git-series

RFC: feature

Page 4: Versioning commits and patches with git-series

RFC: feature

Page 5: Versioning commits and patches with git-series

Development

Page 6: Versioning commits and patches with git-series

git commit

Page 7: Versioning commits and patches with git-series

git format-patch -3

[PATCH 1/3] Cleanup and yak shaving

[PATCH 2/3] Implement feature

[PATCH 3/3] Use feature

Page 8: Versioning commits and patches with git-series

git format-patch -3

[PATCH 1/3] Cleanup and yak shaving

[PATCH 2/3] Implement feature

[PATCH 3/3] Use feature

Page 9: Versioning commits and patches with git-series

git request-pull ...

git hub pull new ...

Page 10: Versioning commits and patches with git-series

git request-pull ...

git hub pull new ...

Page 11: Versioning commits and patches with git-series

Feedback

Split cleanup and yak shaving

Additional use of feature

Add benchmark data

Add tests

Fix typo

Page 12: Versioning commits and patches with git-series

Feedback

Split cleanup and yak shaving

Additional use of feature

Add benchmark data

Add tests

Fix typo

Page 13: Versioning commits and patches with git-series

Feedback

Split cleanup and yak shaving

Additional use of feature

Add benchmark data

Add tests

Fix typo

Page 14: Versioning commits and patches with git-series

Feedback

Split cleanup and yak shaving

Additional use of feature

Add benchmark data

Add tests

Fix typo

Page 15: Versioning commits and patches with git-series

Feedback

Split cleanup and yak shaving

Additional use of feature

Add benchmark data

Add tests

Fix typo

Page 16: Versioning commits and patches with git-series

Rewriting history

Page 17: Versioning commits and patches with git-series

git commit --amend

Page 18: Versioning commits and patches with git-series

git rebase -i

Page 19: Versioning commits and patches with git-series

“fast-forward” vs “non-fast-forward”

Page 20: Versioning commits and patches with git-series

git format-patch -v2 -6

[PATCH v2 1/6] Cleanup

[PATCH v2 2/6] Yak shaving

[PATCH v2 3/6] Implement feature

[PATCH v2 4/6] Tests for feature

[PATCH v2 5/6] Use feature

[PATCH v2 6/6] Use feature elsewhere

Page 21: Versioning commits and patches with git-series

git format-patch -v2 -6

[PATCH v2 1/6] Cleanup

[PATCH v2 2/6] Yak shaving

[PATCH v2 3/6] Implement feature

[PATCH v2 4/6] Tests for feature

[PATCH v2 5/6] Use feature

[PATCH v2 6/6] Use feature elsewhere

Page 22: Versioning commits and patches with git-series

What about v1?

Page 23: Versioning commits and patches with git-series

git reflog

Page 24: Versioning commits and patches with git-series

mutt -f =Sent

Page 25: Versioning commits and patches with git-series

Public mailing list archives

Page 26: Versioning commits and patches with git-series

Git tracks history

Page 27: Versioning commits and patches with git-series

We rewrite history

Page 28: Versioning commits and patches with git-series

We need the history of history

Page 29: Versioning commits and patches with git-series

git submodule

-- --fthagn

Page 30: Versioning commits and patches with git-series

git submodule -- --fthagn

Page 31: Versioning commits and patches with git-series

Two common solutions

Pull one of the histories out of git

Page 32: Versioning commits and patches with git-series

Two common solutions

Pull one of the histories out of git

Page 33: Versioning commits and patches with git-series

Pull the patches out of git

Page 34: Versioning commits and patches with git-series

quilt patch files

Page 35: Versioning commits and patches with git-series

debian/patches/*

Page 36: Versioning commits and patches with git-series

git rebase -i

Page 37: Versioning commits and patches with git-series

Pull the history of the patches out of git

Page 38: Versioning commits and patches with git-series

Versioned branch names

Page 39: Versioning commits and patches with git-series

feature-v1

feature-v2

feature-v3-typofix

feature-v8-rebased-4.6-alice-fix

feature-v8-rebased-4.6-alice-fix.pptx

Page 40: Versioning commits and patches with git-series

feature-v1

feature-v2

feature-v3-typofix

feature-v8-rebased-4.6-alice-fix

feature-v8-rebased-4.6-alice-fix.pptx

Page 41: Versioning commits and patches with git-series

feature-v1

feature-v2

feature-v3-typofix

feature-v8-rebased-4.6-alice-fix

feature-v8-rebased-4.6-alice-fix.pptx

Page 42: Versioning commits and patches with git-series

feature-v1

feature-v2

feature-v3-typofix

feature-v8-rebased-4.6-alice-fix

feature-v8-rebased-4.6-alice-fix.pptx

Page 43: Versioning commits and patches with git-series

feature-v1

feature-v2

feature-v3-typofix

feature-v8-rebased-4.6-alice-fix

feature-v8-rebased-4.6-alice-fix.pptx

Page 44: Versioning commits and patches with git-series

We have a version control system!

Page 45: Versioning commits and patches with git-series

Cover letter

[PATCH v2 0/5] feature: summary of new idea

Page 46: Versioning commits and patches with git-series

Cover letter

[PATCH v2 0/5] feature: summary of new idea

Page 47: Versioning commits and patches with git-series

Base

git format-patch -3

git format-patch -v2 -6

git rebase -i ...

git log

Page 48: Versioning commits and patches with git-series

Base

git format-patch -3

git format-patch -v2 -6

git rebase -i ...

git log

Page 49: Versioning commits and patches with git-series

Base

git format-patch -3

git format-patch -v2 -6

git rebase -i ...

git log

Page 50: Versioning commits and patches with git-series

Base

git format-patch -3

git format-patch -v2 -6

git rebase -i ...

git log

Page 51: Versioning commits and patches with git-series

Collaboration

Page 52: Versioning commits and patches with git-series

“Never rewrite published history”

Page 53: Versioning commits and patches with git-series

How can you collaborate on it?

Page 54: Versioning commits and patches with git-series

Patch series

Feature backport

Distribution package

Page 55: Versioning commits and patches with git-series

Patch series

Feature backport

Distribution package

Page 56: Versioning commits and patches with git-series

Patch series

Feature backport

Distribution package

Page 57: Versioning commits and patches with git-series

git-series

Tracks the history of a patch series

Handles non-fast-forwarding changes

Tracks a cover letter

Tracks the base of the series

Page 58: Versioning commits and patches with git-series

git-series

Tracks the history of a patch series

Handles non-fast-forwarding changes

Tracks a cover letter

Tracks the base of the series

Page 59: Versioning commits and patches with git-series

git-series

Tracks the history of a patch series

Handles non-fast-forwarding changes

Tracks a cover letter

Tracks the base of the series

Page 60: Versioning commits and patches with git-series

git-series

Tracks the history of a patch series

Handles non-fast-forwarding changes

Tracks a cover letter

Tracks the base of the series

Page 61: Versioning commits and patches with git-series

git-series

Tracks the history of a patch series

Handles non-fast-forwarding changes

Tracks a cover letter

Tracks the base of the series

Page 62: Versioning commits and patches with git-series

Demo

Page 63: Versioning commits and patches with git-series

Internals

INTERNALS.mdhttps://github.com/git-series/git-series/blob/master/INTERNALS.md

Page 64: Versioning commits and patches with git-series

Internals

INTERNALS.mdhttps://github.com/git-series/git-series/blob/master/INTERNALS.md

Page 65: Versioning commits and patches with git-series

Review of git internals

blob (file)

tree (directory)

commit (tree, message, parents)

tag

ref

Page 66: Versioning commits and patches with git-series

Review of git internals

blob (file)

tree (directory)

commit (tree, message, parents)

tag

ref

Page 67: Versioning commits and patches with git-series

Review of git internals

blob (file)

tree (directory)

commit (tree, message, parents)

tag

ref

Page 68: Versioning commits and patches with git-series

Review of git internals

blob (file)

tree (directory)

commit (tree, message, parents)

tag

ref

Page 69: Versioning commits and patches with git-series

Review of git internals

blob (file)

tree (directory)

commit (tree, message, parents)

tag

ref

Page 70: Versioning commits and patches with git-series

Review of git internals

blob (file)

tree (directory)

commit (tree, message, parents)

tag

ref

Page 71: Versioning commits and patches with git-series

trees can refer to commits

“gitlink”

Page 72: Versioning commits and patches with git-series

trees can refer to commits

“gitlink”

Page 73: Versioning commits and patches with git-series

Requirement: Every object must remain reachable by git.

Required to keep git from pruning objects

Required for push/pull of series

Page 74: Versioning commits and patches with git-series

Requirement: Every object must remain reachable by git.

Required to keep git from pruning objects

Required for push/pull of series

Page 75: Versioning commits and patches with git-series

upstream x

upstream y

v1 b

v1 a

v2 b

v2 a

series v1 series v2 refs/heads/git-series/feature

series

base

series

base

cover letter blob

cover

Page 76: Versioning commits and patches with git-series

upstream x

upstream y

v1 b

v1 a

v2 b

v2 a

series v1 series v2

refs/heads/git-series/feature

series

base

series

base

cover letter blob

cover

Page 77: Versioning commits and patches with git-series

upstream x

upstream y

v1 b

v1 a

v2 b

v2 a

series v1 series v2 refs/heads/git-series/feature

series

base

series

base

cover letter blob

cover

Page 78: Versioning commits and patches with git-series

upstream x

upstream y

v1 b

v1 a

v2 b

v2 a

series v1 series v2 refs/heads/git-series/feature

series

base

series

base

cover letter blob

cover

Page 79: Versioning commits and patches with git-series

upstream x

upstream y

v1 b

v1 a

v2 b

v2 a

series v1 series v2 refs/heads/git-series/feature

series

base

series

base

cover letter blob

cover

Page 80: Versioning commits and patches with git-series

upstream x

upstream y

v1 b

v1 a

v2 b

v2 a

series v1 series v2 refs/heads/git-series/feature

series

base

series

base

cover letter blob

cover

Page 81: Versioning commits and patches with git-series

upstream x

upstream y

v1 b

v1 a

v2 b

v2 a

series v1 series v2 refs/heads/git-series/feature

series

base

series

base

cover letter blob

cover

Page 82: Versioning commits and patches with git-series

upstream x

upstream y

v1 b

v1 a

v2 b

v2 a

series v1 series v2 refs/heads/git-series/feature

series

base

series

base

cover letter blob

cover

Page 83: Versioning commits and patches with git-series

git doesn’t follow gitlinks for reachability or push/pull

Have to also include “series” as a parent

git-series ignores that parent when traversing

Page 84: Versioning commits and patches with git-series

git doesn’t follow gitlinks for reachability or push/pull

Have to also include “series” as a parent

git-series ignores that parent when traversing

Page 85: Versioning commits and patches with git-series

git doesn’t follow gitlinks for reachability or push/pull

Have to also include “series” as a parent

git-series ignores that parent when traversing

Page 86: Versioning commits and patches with git-series

HEAD → Current branch

refs/SHEAD → Current series

Page 87: Versioning commits and patches with git-series

HEAD → Current branch

refs/SHEAD → Current series

Page 88: Versioning commits and patches with git-series

Working and staged (as seen in status)?

refs/git-series-internals/working/feature

refs/git-series-internals/staged/feature

Page 89: Versioning commits and patches with git-series

Working and staged (as seen in status)?

refs/git-series-internals/working/feature

refs/git-series-internals/staged/feature

Page 90: Versioning commits and patches with git-series

Avoiding errors

Page 91: Versioning commits and patches with git-series

Long and complex error messages

suggest a design flaw

Redesign to make the error impossible

Page 92: Versioning commits and patches with git-series

Long and complex error messagessuggest a design flaw

Redesign to make the error impossible

Page 93: Versioning commits and patches with git-series

Long and complex error messagessuggest a design flaw

Redesign to make the error impossible

Page 94: Versioning commits and patches with git-series

Detach from a series or check out a newseries with uncommitted changes to the

series (series, base, cover)

Every series has its own independentworking and staged versions

Page 95: Versioning commits and patches with git-series

Detach from a series or check out a newseries with uncommitted changes to the

series (series, base, cover)

Every series has its own independentworking and staged versions

Page 96: Versioning commits and patches with git-series

Detach from a series or check out a newseries without making any commits

git series start makes working/staged“(new, no commits yet)”

git series checkout works

Page 97: Versioning commits and patches with git-series

Detach from a series or check out a newseries without making any commits

git series start makes working/staged

“(new, no commits yet)”git series checkout works

Page 98: Versioning commits and patches with git-series

Detach from a series or check out a newseries without making any commits

git series start makes working/staged“(new, no commits yet)”

git series checkout works

Page 99: Versioning commits and patches with git-series

Detach from a series or check out a newseries without making any commits

git series start makes working/staged“(new, no commits yet)”

git series checkout works

Page 100: Versioning commits and patches with git-series

Long and complex error messagessuggest a design flaw

Redesign to make the error impossible

Page 101: Versioning commits and patches with git-series

git series rebase

git rebase --continue

Page 102: Versioning commits and patches with git-series

git series rebase

git rebase --continue

Page 103: Versioning commits and patches with git-series

Rust and libgit2

Page 104: Versioning commits and patches with git-series

https://github.com/git-series/git-series

Questions?

Page 105: Versioning commits and patches with git-series

https://github.com/git-series/git-series

Questions?