Transcript .pptx
Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015 © 2015 Albion College | BUGMI 2015 1 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? © 2015 Albion College | BUGMI 2015 2 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 © 2015 Albion College | BUGMI 2015 3 Git Tenets and Conventions • • • • • • Distributed Branching model Social Curated Democratic Perspective based © 2015 Albion College | BUGMI 2015 4 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 © 2015 Albion College | BUGMI 2015 5 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 © 2015 Albion College | BUGMI 2015 6 Directed Acyclic Graph Directed Graph Directed Cyclic Graph Directed Acyclic Graph © 2015 Albion College | BUGMI 2015 7 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 © 2015 Albion College | BUGMI 2015 8 Working Directory Student Branch . ├── ├── ├── ├── │ │ │ ├── ├── │ ├── │ └── 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 General Branch . ├── ├── ├── ├── │ ├── │ │ │ ├── ├── │ └── 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 Master Branch . ├── ├── ├── ├── │ ├── │ │ │ ├── ├── │ ├── │ └── 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 © 2015 Albion College | BUGMI 2015 9 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 © 2015 Albion College | BUGMI 2015 10 Staging Area No Changes . ├── ├── ├── ├── │ ├── ├── │ ├── │ └── bannerOH.jsp copyright.html error.jsp images ├── bannertoc.jpg mastertoc.jsp META-INF └── MANIFEST.MF student ├── sgastdn.html WEB-INF └── web.xml Changes . ├── ├── ├── ├── │ ├── │ │ ├── ├── │ ├── │ └── 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 Stage copyright.html general/goaemal.html images/toc1.gif student/sgastdn.html Final Result . ├── ├── ├── ├── │ ├── │ │ ├── ├── │ └── bannerOH.jsp copyright.html error.jsp general ├── goaemal.html images ├── bannertoc.jpg ├── toc1.gif mastertoc.jsp META-INF └── MANIFEST.MF WEB-INF └── web.xml © 2015 Albion College | BUGMI 2015 11 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 © 2015 Albion College | BUGMI 2015 12 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 © 2015 Albion College | BUGMI 2015 13 New Branches Initial State New Branch Checkout © 2015 Albion College | BUGMI 2015 14 Merging © 2015 Albion College | BUGMI 2015 15 Fast-Forward Merges Initial State Add Commits Checkout Merge © 2015 Albion College | BUGMI 2015 16 Non-FF Merge Initial State Hotfix Checkout Merge © 2015 Albion College | BUGMI 2015 17 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 © 2015 Albion College | BUGMI 2015 18 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 © 2015 Albion College | BUGMI 2015 19 Merge Conflicts copyright.html <<<<<<< HEAD This 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 © 2015 Albion College | BUGMI 2015 20 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> © 2015 Albion College | BUGMI 2015 21 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 © 2015 Albion College | BUGMI 2015 22 Rebase Initial State Rebase Finalize Garbage Collect © 2015 Albion College | BUGMI 2015 23 Remotes © 2015 Albion College | BUGMI 2015 24 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 © 2015 Albion College | BUGMI 2015 25 Remotes Initial State Remote Hotfix Fetch Merge © 2015 Albion College | BUGMI 2015 26 Remotes – Local Merge Initial State Hotfix Checkout Merge © 2015 Albion College | BUGMI 2015 27 Remotes Initial Local Initial Remote Local Push Remote Push © 2015 Albion College | BUGMI 2015 28 Miscellaneous Commands © 2015 Albion College | BUGMI 2015 29 Reset • Reset is used to move branch pointers anywhere on the DAG • Fast-forward merges are examples of reset © 2015 Albion College | BUGMI 2015 30 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 © 2015 Albion College | BUGMI 2015 31 Git and Banner © 2015 Albion College | BUGMI 2015 32 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 © 2015 Albion College | BUGMI 2015 33 Banner Release Structure in Git ebachle@machine /git/banner_student_registration_ssb_app ((rel-registration-9.3)) $ git tag -l 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 © 2015 Albion College | BUGMI 2015 34 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) © 2015 Albion College | BUGMI 2015 35 Thank you! Eddie Bachle [email protected] © 2015 Albion College | BUGMI 2015 36