1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle...

36
1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015

Transcript of 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle...

Page 1: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

1© 2015 Albion College | BUGMI 2015

Git’s ArchitectureAnd How It Relates to Banner

Eddie Bachle

Albion College

September 25, 2015

Page 2: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

2© 2015 Albion College | BUGMI 2015

Survey Questions

• Who has used what version control in the past?• Git, Subversion, Mercurial, etc.

• Who has mods to Banner?• 0, 1+, 5+, 10+, 20+, more than that!?

• Who has cloned the Ellucian Git repositories?• Who has an XE module in production

• With mods?

Page 3: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

3© 2015 Albion College | BUGMI 2015

Introduction

• This is not a “type this command” Git presentation• How the commands you type actually work• Learn the lingo to be able to Google for answers• Hopefully a start toward the “Git epiphany”• Git is an architectural element in Banner XE• Git isn’t something you just install for Banner XE

Page 4: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

4© 2015 Albion College | BUGMI 2015

Git Tenets and Conventions

• Distributed• Branching model• Social• Curated• Democratic• Perspective based

Page 5: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

5© 2015 Albion College | BUGMI 2015

SHA-1 Sum

• 40-digit cryptographic hash• “test” > a94a8fe5ccb19ba61c4c0873d391e987982fbbd3• > 0b5880020f9f2beae111b3109656e9c8496c3d30• Universal identifier for immutable objects in Git• Blobs, trees, and commits• Commits are the object typically interacted with via SHA-1• Usually 6-8 of the 40 characters can be unique

Page 6: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

6© 2015 Albion College | BUGMI 2015

Directed Acyclic Graph

• Math behind the magic• Nodes (commits)• Edges (parent/child relationships)

• Graphic conventions• Time (for commits) is along the Y axis• Time (for our actions) is along the X axis• Arrows point to the parent of a comment, not the child

Page 7: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

7© 2015 Albion College | BUGMI 2015

Directed Acyclic Graph

Directed Graph Directed Cyclic Graph Directed Acyclic Graph

Page 8: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

8© 2015 Albion College | BUGMI 2015

Working Directory

• Root directory of your project (Banner app/plugin)• .git directory (contains the innards of Git)• Files and folders tracked in the Git repository

• Mutable expression of “location” in Git repository

Page 9: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

9© 2015 Albion College | BUGMI 2015

Working Directory

.├── bannerOH.jsp├── copyright.html├── error.jsp├── general│   ├── goaemal.html├── images│   ├── bannertoc.jpg│   ├── toc1.gif│   └── toc2.gif├── mastertoc.jsp├── META-INF│   └── MANIFEST.MF├── student│   ├── sgastdn.html└── WEB-INF └── web.xml

.├── bannerOH.jsp├── copyright.html├── error.jsp├── images│   ├── bannertoc.jpg│   ├── toc1.gif│   └── toc2.gif├── mastertoc.jsp├── META-INF│   └── MANIFEST.MF├── student│   ├── sgastdn.html└── WEB-INF └── web.xml

.├── bannerOH.jsp├── copyright.html├── error.jsp├── general│   ├── goaemal.html├── images│   ├── bannertoc.jpg│   ├── toc1.gif│   └── toc2.gif├── mastertoc.jsp├── META-INF│   └── MANIFEST.MF└── WEB-INF └── web.xml

Student Branch General Branch Master Branch

Page 10: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

10© 2015 Albion College | BUGMI 2015

Staging Area

• It’s actually in the .git directory• Also called the “index” in documentation• git add

• add whole files, hunks of changes in a file, or single lines

• git reset HEAD $filename• Can be used to unstage changes to specific files

• git commit• commits only what's in the staging area

Page 11: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

11© 2015 Albion College | BUGMI 2015

Staging Area

copyright.htmlgeneral/goaemal.htmlimages/toc1.gifstudent/sgastdn.html

.├── bannerOH.jsp├── copyright.html├── error.jsp├── images│   ├── bannertoc.jpg├── mastertoc.jsp├── META-INF│   └── MANIFEST.MF├── student│   ├── sgastdn.html└── WEB-INF └── web.xml

.├── bannerOH.jsp├── copyright.html├── error.jsp├── general│   ├── goaemal.html├── images│   ├── bannertoc.jpg│   ├── toc1.gif├── mastertoc.jsp├── META-INF│   └── MANIFEST.MF├── student│   ├── sgastdn.html└── WEB-INF └── web.xml

No Changes Changes Stage.├── bannerOH.jsp├── copyright.html├── error.jsp├── general│   ├── goaemal.html├── images│   ├── bannertoc.jpg│   ├── toc1.gif├── mastertoc.jsp├── META-INF│   └── MANIFEST.MF└── WEB-INF └── web.xml

Final Result

Page 12: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

12© 2015 Albion College | BUGMI 2015

Commits

• Nodes in the DAG• Storage type for changes (deltas)• Identified by hash computed from:

• Tree objects (including deltas)• Commit message and timestamp• Parent commit(s) SHA-1 values

• All commits are immutable• Parent commit SHA-1 ensures integrity• All history rewrites create new commits, not alter old ones

Page 13: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

13© 2015 Albion College | BUGMI 2015

Branches

• The heart of Git’s flexibility• Movable pointers to commits• HEAD is a special pointer to a branch (your perspective)• git checkout moves HEAD between branches• checkout actions don’t change state or history• HEAD is the perspective from which new commits are made• 40 character file in .git directory• Functionally “free” to create or destroy

Page 14: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

14© 2015 Albion College | BUGMI 2015

New Branches

Initial State New Branch Checkout

Page 15: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

15© 2015 Albion College | BUGMI 2015

Merging

Page 16: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

16© 2015 Albion College | BUGMI 2015

Fast-Forward Merges

Initial State Add Commits Checkout Merge

Page 17: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

17© 2015 Albion College | BUGMI 2015

Non-FF Merge

Initial State Hotfix Checkout Merge

Page 18: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

18© 2015 Albion College | BUGMI 2015

Merge Conflicts

• Generated when same line changed by two merging branches• Git is very good at resolving these typically• Merge conflicts are in a “suspense” state like GOAMTCH• Conflicting files will have diff sections added• Update the files to read the way they should when resolved• Stage all the resolved conflicts and commit, then you’re done

Page 19: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

19© 2015 Albion College | BUGMI 2015

Merge Conflicts

This documentation is proprietary information of SCT and is not to be copied<BR>SCT<BR>4 Country View Road<BR>Malvern, Pennsylvania 19355<BR>United States of America<BR>

• Updated to say SunGard Higher Education on feature branch• Updated to say Ellucian as a hotfix on the master branch• Address kept the same

Page 20: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

20© 2015 Albion College | BUGMI 2015

Merge Conflicts

copyright.html<<<<<<< HEADThis documentation is proprietary information of Ellucian and is not to be copied<BR>Ellucian<BR>=======This documentation is proprietary information of SunGard Higher Education and is not to be copied<BR>SunGard Higher Education<BR>>>>>>>> feature

Page 21: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

21© 2015 Albion College | BUGMI 2015

Merge Conflicts

Final result was

This documentation is proprietary information of Ellucian and is not to be copied<BR>Ellucian<BR>4 Country View Road<BR>Malvern, Pennsylvania 19355<BR>United States of America<BR>

Page 22: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

22© 2015 Albion College | BUGMI 2015

Rebase

• The other branch integration method instead of merge• The process of moving a branch to a new base commit. • Rebase is a powerful technique used to rewrite history• git rebase <base>• <base> represents any commit identifier• Don’t rebase public history (notice don’t, not can’t)• Enough talk, let’s see an example

Page 23: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

23© 2015 Albion College | BUGMI 2015

Rebase

Initial State Rebase Finalize Garbage Collect

Page 24: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

24© 2015 Albion College | BUGMI 2015

Remotes

Page 25: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

25© 2015 Albion College | BUGMI 2015

Remotes

• Bookmarks to other individual or group’s repositories• Allows synchronization of code change history• Conventional names are used for “organizational repos”

• upstream, origin, etc.

• In baseline Git, collaboration is managed by social convention• Rewriting public history is rude, near impermissible, but not impossible

Page 26: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

26© 2015 Albion College | BUGMI 2015

Remotes

Initial State Remote Hotfix Fetch Merge

Page 27: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

27© 2015 Albion College | BUGMI 2015

Remotes – Local Merge

Initial State Hotfix Checkout Merge

Page 28: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

28© 2015 Albion College | BUGMI 2015

Remotes

Initial Local Initial Remote Local Push Remote Push

Page 29: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

29© 2015 Albion College | BUGMI 2015

Miscellaneous Commands

Page 30: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

30© 2015 Albion College | BUGMI 2015

Reset

• Reset is used to move branch pointers anywhere on the DAG• Fast-forward merges are examples of reset

Page 31: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

31© 2015 Albion College | BUGMI 2015

Tag

• Named identifier for a commit• Analogous to an immutable branch• Often used to signify versioned releases• Can be PGP signed to ensure integrity

• May be helpful to appease auditors

Page 32: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

32© 2015 Albion College | BUGMI 2015

Git and Banner

Page 33: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

33© 2015 Albion College | BUGMI 2015

Banner Perspective

• Ellucian provides a single repository from which we clone• That repository is the remote to the local central repo• That local central repo is the remote to each developer• However, this is just one possible structure

Page 34: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

34© 2015 Albion College | BUGMI 2015

Banner Release Structure in Git

grails137-eol

reg-9.2-post9.12upgrade-1

reg-9.2-system-test

reg-cloud2015-dev

reg-comnsystest-ga-9.2

reg-ga-9.2

reg-ga-9.2.0.1

reg-ga-9.2.0.1-branch

reg-grails221-eol

reg-grails237-intro

reg-mergetomaster-ga-9.2

reg-nat-ga-9.2

reg-systestfreeze-ga-9.2

reg-systestfreeze2-ga-9.2

registration-cr2-freeze

registration-cr2-patch2

registration-cr2-softfreeze

registration-cr2-systest

rel-registration-9.2

rel-registration-9.2.0.1

rel-registration-9.3

release-alpha-II-9.0

release-alpha-II-9.0-natfix

release-alphaI-9.0

release-alphaI-9.0-update

release-registration-cr1

ebachle@machine /git/banner_student_registration_ssb_app ((rel-registration-9.3)) $ git tag -l

Page 35: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

35© 2015 Albion College | BUGMI 2015

Merging Ellucian Updates

• This is where the question of mods is relevant• Each mod could be treated as a local feature branch• Each Ellucian version update could be merged like a feature• Git’s conflict resolution helps ensure consistency• Much faster mod integration process (in my experience)

Page 36: 1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.

36© 2015 Albion College | BUGMI 2015

Thank you!

Eddie [email protected]