SlideShare a Scribd company logo
1 of 17
Make Git Understand
Excel Workbooks
Bjoern Stiel xltrail.com
xltrail.com
Spreadsheets Are Code
xltrail.com
How The Pros Do It
xltrail.com
What Is Git?
• Git isthe mosttrustedversion controlsystem
• It is open-source
• Git !=GitHub
• Easilyextendable,following theUNIX philosophy
• Thriving ecosystem
• Greatbranchingcapabilities
• Featurebranchworkflowis aproductivitybooster
• Flexible
• Notopinionated
xltrail.com
Why Developers Love Git
• Git isdistributedanddecentralised
• Youalwaysget a full copyof therepository
• Git storesversions,notdiffs
• Git canbe(and typicallyis) runin acentralised waywitha centralrepository,typicallyhostedonaserver:
(remote/)origin
• GitHub,Bitbucket,GitLaborGogs (orashareddrive)
• Git isall aboutbranchesandmerge (pull) requests
• The Git workflowalwaysrevolves around
– Fetching changesfrom remote to local
– Pushing changes from local to remote
– Merging branches
– Resolving mergeconflicts
xltrail.com
All You Need To Know About Git
• Createnew repository:git init
• Cloneexisting repository(get yourlocal copy):git clone <url>
• Stagechanges:git add<path>/ git add.
• Commit changes:git commit–m <message>
• Fetch updatesfromorigin: git fetchorigin
• Merge branches:git merge <branch>
• Fetch andmerge fromremoteinto localbranch:git pull origin
• Pushchanges fromlocalto remote:git push
• Showchangelog: git log
• Showdifferencesbetween twocommits/branches:git diff
xltrail.com
Git and Excel… Will It Work?
xltrail.com
Git and Excel… Will It Work?
• Outofthe box,goodenough tocreateauditlogs andmanageversions
• Butnotexactlynotlove atfirstsight
• Workbooksarejustbinaryfiles(blackbox) toGit
• git diffandgit merge areuseless
• Git knowsthataworkbookhaschanged (file hash)butthatin itself isnotuseful enough
• Git’sdecentraliseddesign couldget in ourway:
– Full repository clone
– If we commit a 5mbworkbook twice/day, we end up with 250x 2x 5mb~ 2.5gb repository sizeafter one year
– git clone becomes painfully slow, takes up a lot of space
• Ensurerepositorydoesnotblow upin size
xltrail.com
G(r)it, Spit, And a Whole Lot of Duct Tape
• Git is(very) flexible
• Git isnotopinionated
• Git hasa thriving ecosystem
• How canweensureourrepositoriesdo notexplodein size?
• How canwemage git diff/ git mergeworkwith Excelworkbooks?
• How canweshareworkbookswithoutlosing oursanity?
It’sgameon!
xltrail.com
Git Large File Storage (Git LFS)
• Readilyavailablesolution:Git LFS
• Open-sourceGit extension
• BackedbyGitHub
• Server-siderequirements
• Workswithall majorGit server systems
• Install,fireandforget
• Worksits magic behind thescenes
• Standardgit commandsandworkflowscontinuetoapply
• Youdon’tnoticea thing
xltrail.com
Option 1: Version-control VBA with Git Hooks
• AsknotwhatGit candoforExcel –askwhatExcel candoforGit
• MaintainVBAcode“outsideExcel”
– Export VBA code fromworkbook into standalone text files
– Usebuilt-ingit diff/git merge
– ImportVBA code back into workbook after mergeoperations
• Git hooksareevent triggers toexecute codeoncertainGit actions
• Git pre-commithook
– Triggeredbefore git commit
– Execute code to export a copy of the workbook’s VBAcode into text files
– Text files are added to the commit
– Actual commit is executed
• git merge worksoutof theboxbuthastobere-importedmanuallyintoworkbook
xltrail.com
Option 2: git diff with Spreadsheet Compare
• UseSpreadsheetComparewheninvoking git diffon Excelworkbooks
• WorkswithDesktopclients (Sourcetree)
• Nowaytomakegit merge work(semi-)automatically
• Noautomaticmerges
• Manualmerges alwaysdoableaslong as thereis areadablediff
xltrail.com
Option 3: git xltrail
• AsknotwhatExcelcan doforGit –askwhatGit can doforExcel
• Free, open-sourceproject:https://github.com/ZoomerAnalytics/git-xltrail
• Customdiffer/ custommergedriver forworkbooks
• Integratesdirectlywith Git
• StandardGit workflowsandcommandsandcontinue toapply
• Currentstateof theopen-sourceproject/roadmap
xltrail.com
Git Workflows 1: Handling Merge Conflicts
• Workflow problems allrevolve aroundmerge conflicts
– Someonepushed to remotewhilewewereediting thebranch locally
– How to mergechanges from our branch backinto themasterbranch
– This is all by designas Git is a distributed versioncontrol system
• Single branchworkflow
– Everybodyworkson master
– Mergeconflict whennewcommits have beenpushed in themeantime
• Solution 1:
– gitstash / gitpull –theirs /gitstash pop
– Getslatestfrom remote,diff against ourversionand mergemanually
• Solution 2
– gitpull –ours
– Getslatestversionfrom remoteand resolvemergeconflict by makingour versionthe newlatestcommit(bruteforce)
• Solution 3
– Mergefor real
• Similar issues andremedies apply to branch-basedworkflow
xltrail.com
Git Workflows 2: Avoid Merge Conflicts
• Avoid merge conflictsin thefirstplace
• Simple,dummyproof,easytounderstand
• Worksforsingle-branchworkflows(everybodyworkson master)
• Verysimilar toworkingon ashareddrive
• Git LFSincludesfile locking sinceversion 2.0.0
– git lfs lock Book1.xlsb
– Locks the file exclusively
• Fun fact:Backtocentralised version controlsystem
xltrail.com
I think this is the beginning
of a beautiful friendship
• Git andExcelcan work
• Leveragesa well establishedversion controlsystem
• Canbeascomplex (or assimple) aswewantit tobe
• Whoisit for?
– Excel/VBA developer
– The“business” Excel user
xltrail.com
No diff viewer (client)
Thank You
https://www.xltrail.com
bjoern.stiel@zoomeranalytics.com
https://linkedin.com/in/bjoernstiel

More Related Content

What's hot

Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...WSO2
 
Git locally - part 1
Git locally - part 1Git locally - part 1
Git locally - part 1ahmadezzeir
 
Git & Github @ ROSEdu CDL
Git & Github @ ROSEdu CDLGit & Github @ ROSEdu CDL
Git & Github @ ROSEdu CDLAlex Palcuie
 
Introduction to Git and GitHub Part 2
Introduction to Git and GitHub Part 2Introduction to Git and GitHub Part 2
Introduction to Git and GitHub Part 2Omar Fathy
 
Learn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsLearn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsGorav Singal
 
Introduction to GitHub
Introduction to GitHubIntroduction to GitHub
Introduction to GitHubNishan Bose
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHubDSCVSSUT
 
Git Going w/ Git
Git Going w/ GitGit Going w/ Git
Git Going w/ GitheyMP
 
Git and GitHub crash course
Git and GitHub crash courseGit and GitHub crash course
Git and GitHub crash courseMireia Sangalo
 
Fundamentals of Git
Fundamentals of GitFundamentals of Git
Fundamentals of Gitcmckni3
 
Getting Started with Git and GitHub
Getting Started with Git and GitHubGetting Started with Git and GitHub
Getting Started with Git and GitHubRabiraj Khadka
 
Git hub for designers
Git hub for designersGit hub for designers
Git hub for designersFITC
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubGDSCIIITBbsr
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-BryanLearningTech
 
Thomson Reuters, TMS: Workflow in GitLab
Thomson Reuters, TMS: Workflow in GitLabThomson Reuters, TMS: Workflow in GitLab
Thomson Reuters, TMS: Workflow in GitLabMatan Keidar
 
CICD Pipeline Using Github Actions
CICD Pipeline Using Github ActionsCICD Pipeline Using Github Actions
CICD Pipeline Using Github ActionsKumar Shìvam
 
Using GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to AzureUsing GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to AzureKasun Kodagoda
 
GitHub Actions demo with mabl
GitHub Actions demo with mablGitHub Actions demo with mabl
GitHub Actions demo with mablBertold Kolics
 

What's hot (20)

Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
 
Git locally - part 1
Git locally - part 1Git locally - part 1
Git locally - part 1
 
Git & Github @ ROSEdu CDL
Git & Github @ ROSEdu CDLGit & Github @ ROSEdu CDL
Git & Github @ ROSEdu CDL
 
Git theory
Git   theoryGit   theory
Git theory
 
Introduction to Git and GitHub Part 2
Introduction to Git and GitHub Part 2Introduction to Git and GitHub Part 2
Introduction to Git and GitHub Part 2
 
Learn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsLearn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levels
 
Introduction to GitHub
Introduction to GitHubIntroduction to GitHub
Introduction to GitHub
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
 
Git Going w/ Git
Git Going w/ GitGit Going w/ Git
Git Going w/ Git
 
Git & GitHub N00bs
Git & GitHub N00bsGit & GitHub N00bs
Git & GitHub N00bs
 
Git and GitHub crash course
Git and GitHub crash courseGit and GitHub crash course
Git and GitHub crash course
 
Fundamentals of Git
Fundamentals of GitFundamentals of Git
Fundamentals of Git
 
Getting Started with Git and GitHub
Getting Started with Git and GitHubGetting Started with Git and GitHub
Getting Started with Git and GitHub
 
Git hub for designers
Git hub for designersGit hub for designers
Git hub for designers
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHub
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-Bryan
 
Thomson Reuters, TMS: Workflow in GitLab
Thomson Reuters, TMS: Workflow in GitLabThomson Reuters, TMS: Workflow in GitLab
Thomson Reuters, TMS: Workflow in GitLab
 
CICD Pipeline Using Github Actions
CICD Pipeline Using Github ActionsCICD Pipeline Using Github Actions
CICD Pipeline Using Github Actions
 
Using GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to AzureUsing GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to Azure
 
GitHub Actions demo with mabl
GitHub Actions demo with mablGitHub Actions demo with mabl
GitHub Actions demo with mabl
 

Similar to Make Git Understand Excel Workbooks - Eusprig 2018

Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitRobert Lee-Cann
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubBigBlueHat
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
Learn Git form Beginners to Master
Learn Git form Beginners to MasterLearn Git form Beginners to Master
Learn Git form Beginners to MasterC. M. Abdullah Khan
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIsTim Osborn
 
11 git version control
11 git version control11 git version control
11 git version controlWasim Alatrash
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptxtnscharishma
 
Git Workflow
Git WorkflowGit Workflow
Git WorkflowGary Yeh
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02Gourav Varma
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 

Similar to Make Git Understand Excel Workbooks - Eusprig 2018 (20)

Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
git and github
git and githubgit and github
git and github
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git overview
Git overviewGit overview
Git overview
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Learn Git form Beginners to Master
Learn Git form Beginners to MasterLearn Git form Beginners to Master
Learn Git form Beginners to Master
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
11 git version control
11 git version control11 git version control
11 git version control
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Git tips and tricks
Git   tips and tricksGit   tips and tricks
Git tips and tricks
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptx
 
Git Workflow
Git WorkflowGit Workflow
Git Workflow
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
git Technologies
git Technologiesgit Technologies
git Technologies
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 

Recently uploaded

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 

Recently uploaded (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 

Make Git Understand Excel Workbooks - Eusprig 2018

  • 1. Make Git Understand Excel Workbooks Bjoern Stiel xltrail.com
  • 4. xltrail.com What Is Git? • Git isthe mosttrustedversion controlsystem • It is open-source • Git !=GitHub • Easilyextendable,following theUNIX philosophy • Thriving ecosystem • Greatbranchingcapabilities • Featurebranchworkflowis aproductivitybooster • Flexible • Notopinionated
  • 5. xltrail.com Why Developers Love Git • Git isdistributedanddecentralised • Youalwaysget a full copyof therepository • Git storesversions,notdiffs • Git canbe(and typicallyis) runin acentralised waywitha centralrepository,typicallyhostedonaserver: (remote/)origin • GitHub,Bitbucket,GitLaborGogs (orashareddrive) • Git isall aboutbranchesandmerge (pull) requests • The Git workflowalwaysrevolves around – Fetching changesfrom remote to local – Pushing changes from local to remote – Merging branches – Resolving mergeconflicts
  • 6. xltrail.com All You Need To Know About Git • Createnew repository:git init • Cloneexisting repository(get yourlocal copy):git clone <url> • Stagechanges:git add<path>/ git add. • Commit changes:git commit–m <message> • Fetch updatesfromorigin: git fetchorigin • Merge branches:git merge <branch> • Fetch andmerge fromremoteinto localbranch:git pull origin • Pushchanges fromlocalto remote:git push • Showchangelog: git log • Showdifferencesbetween twocommits/branches:git diff
  • 8. xltrail.com Git and Excel… Will It Work? • Outofthe box,goodenough tocreateauditlogs andmanageversions • Butnotexactlynotlove atfirstsight • Workbooksarejustbinaryfiles(blackbox) toGit • git diffandgit merge areuseless • Git knowsthataworkbookhaschanged (file hash)butthatin itself isnotuseful enough • Git’sdecentraliseddesign couldget in ourway: – Full repository clone – If we commit a 5mbworkbook twice/day, we end up with 250x 2x 5mb~ 2.5gb repository sizeafter one year – git clone becomes painfully slow, takes up a lot of space • Ensurerepositorydoesnotblow upin size
  • 9. xltrail.com G(r)it, Spit, And a Whole Lot of Duct Tape • Git is(very) flexible • Git isnotopinionated • Git hasa thriving ecosystem • How canweensureourrepositoriesdo notexplodein size? • How canwemage git diff/ git mergeworkwith Excelworkbooks? • How canweshareworkbookswithoutlosing oursanity? It’sgameon!
  • 10. xltrail.com Git Large File Storage (Git LFS) • Readilyavailablesolution:Git LFS • Open-sourceGit extension • BackedbyGitHub • Server-siderequirements • Workswithall majorGit server systems • Install,fireandforget • Worksits magic behind thescenes • Standardgit commandsandworkflowscontinuetoapply • Youdon’tnoticea thing
  • 11. xltrail.com Option 1: Version-control VBA with Git Hooks • AsknotwhatGit candoforExcel –askwhatExcel candoforGit • MaintainVBAcode“outsideExcel” – Export VBA code fromworkbook into standalone text files – Usebuilt-ingit diff/git merge – ImportVBA code back into workbook after mergeoperations • Git hooksareevent triggers toexecute codeoncertainGit actions • Git pre-commithook – Triggeredbefore git commit – Execute code to export a copy of the workbook’s VBAcode into text files – Text files are added to the commit – Actual commit is executed • git merge worksoutof theboxbuthastobere-importedmanuallyintoworkbook
  • 12. xltrail.com Option 2: git diff with Spreadsheet Compare • UseSpreadsheetComparewheninvoking git diffon Excelworkbooks • WorkswithDesktopclients (Sourcetree) • Nowaytomakegit merge work(semi-)automatically • Noautomaticmerges • Manualmerges alwaysdoableaslong as thereis areadablediff
  • 13. xltrail.com Option 3: git xltrail • AsknotwhatExcelcan doforGit –askwhatGit can doforExcel • Free, open-sourceproject:https://github.com/ZoomerAnalytics/git-xltrail • Customdiffer/ custommergedriver forworkbooks • Integratesdirectlywith Git • StandardGit workflowsandcommandsandcontinue toapply • Currentstateof theopen-sourceproject/roadmap
  • 14. xltrail.com Git Workflows 1: Handling Merge Conflicts • Workflow problems allrevolve aroundmerge conflicts – Someonepushed to remotewhilewewereediting thebranch locally – How to mergechanges from our branch backinto themasterbranch – This is all by designas Git is a distributed versioncontrol system • Single branchworkflow – Everybodyworkson master – Mergeconflict whennewcommits have beenpushed in themeantime • Solution 1: – gitstash / gitpull –theirs /gitstash pop – Getslatestfrom remote,diff against ourversionand mergemanually • Solution 2 – gitpull –ours – Getslatestversionfrom remoteand resolvemergeconflict by makingour versionthe newlatestcommit(bruteforce) • Solution 3 – Mergefor real • Similar issues andremedies apply to branch-basedworkflow
  • 15. xltrail.com Git Workflows 2: Avoid Merge Conflicts • Avoid merge conflictsin thefirstplace • Simple,dummyproof,easytounderstand • Worksforsingle-branchworkflows(everybodyworkson master) • Verysimilar toworkingon ashareddrive • Git LFSincludesfile locking sinceversion 2.0.0 – git lfs lock Book1.xlsb – Locks the file exclusively • Fun fact:Backtocentralised version controlsystem
  • 16. xltrail.com I think this is the beginning of a beautiful friendship • Git andExcelcan work • Leveragesa well establishedversion controlsystem • Canbeascomplex (or assimple) aswewantit tobe • Whoisit for? – Excel/VBA developer – The“business” Excel user
  • 17. xltrail.com No diff viewer (client) Thank You https://www.xltrail.com bjoern.stiel@zoomeranalytics.com https://linkedin.com/in/bjoernstiel

Editor's Notes

  1. Hi, my name is Bjorn Stiel and I am the co-author of xltrail, a Git extension for Excel workbooks. I had some issues trying to come up with a hook for this talk to ignite your excitement. While I was searching for ideas, I came across a Jamie Oliver talk. It’s a TED Talk from 2010 and he stars with: “Sadly, in the next 18 minutes, while we chat, four Americans will be dead from the food they eat.” And I thought that was shocking and exciting at the same time. If anything, in the next 18 minutes, while we chat, 400 Americans will have produced 4000 lines of VBA code and 1200 new spreadsheets. And as you know, Some of the these workbooks are part and parcel of a business. Some have probably been around for a long time. Some look back at a long life of changes, bugs and bug-fixes and varying. Now, we have heard a lot about EUC and version control today. I want you to forget about EUC for a second and take you onto a brief journey through the basics of Git and how it can help you as an Excel/VBA developer by simply leveraging what “professional developers” do for quite some time. It’s all about free/open-source solutions so if you are interested in the snippets I show, please contact me at the end.
  2. Excel workbooks are code. VBA most definitely is code. Spreadsheet formulas are code, too – functional reactive programming, anyone?
  3. Excel workbooks are code. VBA most definitely is code. Spreadsheet formulas are code, too – functional reactive programming, anyone?
  4. Fortunately, there is Git that does just that. What happens when you commit an Excel workbook file into Git? Well, it works, as in: it can be committed. Unfortunately, it is just one big solid black box which Git doesn’t understand. Why is this a problem? In fact, there are two problems: - first one is a size problem; because of the decentralised nature of Git, every developer has the full change history on their computer. Changes in large binary files cause Git repositories to grow by the size of the file in question every time the file is changed and the change is committed; in other words, if you deal with a 5mb workbook which is committed three times a day, your repository grows by ~75mb/week in size. Luckily it is a solved problem, thanks to a Git extension called Git LFS (Large File Storage) - the second problem is that Git does not know what to do with the file. Git knows it’s not a text but a binary file but it is simply a black box. Which renders git-diff and git-merge operations useless. Which in turn makes core features like change management and branching a lot more difficult as we have to resort to manual comparison and manual merging Let’s see how we can make git-diff and git-merge work for Excel workbook files.
  5. Good news is that Git is very flexible. It can be extended easily as Git’s extension model follows the Unix philosophy of composing small, simple programs to achieve a similar effect. That means is that git “extensions” can be written in any language. By following a few simple rules it’s still possible to add commands that appear as if they were built-in. For example, if you wanted to create a custom command, like “git xltrail” you can do so by simply: naming your executable/script git-COMMANDNAME (e.g. git-xltrail.exe) making your executable/script available on $PATH So one way would be to have a custom diff and merge command. Something like “git xltrail diff” and “git xltrail merge” That’s great. But we can do even better: We can even override git builtins like git-diff and git-merge by customising .gitattributes and .gitconfig (globally or per-repository, there is a variety of possibilities). In .gitconfig we define a custom diff command named “xltrail” which executes the command “python /dev/xltrail-client/diff.py” (or a compiled executable). In .gitattributes we define a list of file extensions and instruct git to use “xltrail” for the “diff” command.
  6. Good news is that Git is very flexible. It can be extended easily as Git’s extension model follows the Unix philosophy of composing small, simple programs to achieve a similar effect. That means is that git “extensions” can be written in any language. By following a few simple rules it’s still possible to add commands that appear as if they were built-in. For example, if you wanted to create a custom command, like “git xltrail” you can do so by simply: naming your executable/script git-COMMANDNAME (e.g. git-xltrail.exe) making your executable/script available on $PATH So one way would be to have a custom diff and merge command. Something like “git xltrail diff” and “git xltrail merge” That’s great. But we can do even better: We can even override git builtins like git-diff and git-merge by customising .gitattributes and .gitconfig (globally or per-repository, there is a variety of possibilities). In .gitconfig we define a custom diff command named “xltrail” which executes the command “python /dev/xltrail-client/diff.py” (or a compiled executable). In .gitattributes we define a list of file extensions and instruct git to use “xltrail” for the “diff” command.
  7. Good news is that Git is very flexible. It can be extended easily as Git’s extension model follows the Unix philosophy of composing small, simple programs to achieve a similar effect. That means is that git “extensions” can be written in any language. By following a few simple rules it’s still possible to add commands that appear as if they were built-in. For example, if you wanted to create a custom command, like “git xltrail” you can do so by simply: naming your executable/script git-COMMANDNAME (e.g. git-xltrail.exe) making your executable/script available on $PATH So one way would be to have a custom diff and merge command. Something like “git xltrail diff” and “git xltrail merge” That’s great. But we can do even better: We can even override git builtins like git-diff and git-merge by customising .gitattributes and .gitconfig (globally or per-repository, there is a variety of possibilities). In .gitconfig we define a custom diff command named “xltrail” which executes the command “python /dev/xltrail-client/diff.py” (or a compiled executable). In .gitattributes we define a list of file extensions and instruct git to use “xltrail” for the “diff” command.
  8. That’s diffing sorted. But that’s only the first half of the match. Time to play the second half: git-merge. Without git-merge, we get a git merge conflict every single time as Git simply sees two different binary files. A naïve solution would be: git merge -X ours – which simply resolves the merge conflicts by accepting our version of the file and discarding the other file version. Before we go into technical implementation, you might wonder what the use case for merging workbooks is. People might work on a new VBA feature and branch off master in order to do that. In the meantime, someone fixed a bug on the master branch. Manually merging the changes in… is error-prone. The spreadsheet use case is probably less clear. And more complicated, because of two reasons: spreadsheets are a lot more complicated in the first place (applies to diffing) there’s other stuff to consider, for example named ranges   Back to technical implementation: The road is very similar to what we did with the custom differ. Which means: back to .gitconfig and .gitattributes. The .gitconfig block: The merge block contains the merge driver's identifier, used to reference the merge driver later. The name property contains a description of the merge driver. The driver property contains the command that will be called when a conflict occurs. A handful of predefined parameters, most notably: %O: ancestor’s version of the conflicting file %A: current version of the conflicting file %B: other branches' version of the conflicting file See https://git-scm.com/docs/gitattributes or full reference  
  9. Live coding example
  10. - time for a simple example - spin up example (without xltrail installed) - git xltrail install --local - change VBA code - change spreadsheet code - brief peek into cloud.xltrail.com and spreadsheet differ: https://cloud.xltrail.com/#/workbook/github.com%2FZoomerAnalytics%2Fxltrail-demo.git%2FEvaluator_model.xlsm/sheet/5%20Year%20Plan/diff/3c54f16b657dce1e87e87435597f1376a6d8a926?branch=master