Se ha denunciado esta presentación.
Se está descargando tu SlideShare. ×
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Próximo SlideShare
Git flow Introduction
Git flow Introduction
Cargando en…3
×

Eche un vistazo a continuación

1 de 56 Anuncio

Git for Excel

Descargar para leer sin conexión

When dealing with critical Excel workbooks, you want to have proper source control in place. This presentation is about the different challenges we face when using Git with Excel files and how we can solve them by using the right mix of settings, extensions and Git workflow.

When dealing with critical Excel workbooks, you want to have proper source control in place. This presentation is about the different challenges we face when using Git with Excel files and how we can solve them by using the right mix of settings, extensions and Git workflow.

Anuncio
Anuncio

Más Contenido Relacionado

Presentaciones para usted (20)

Similares a Git for Excel (20)

Anuncio

Más de xlwings (18)

Más reciente (20)

Anuncio

Git for Excel

  1. 1. Git for Excel Felix Zumstein, 23 September 2019 xlwings Meetup London
  2. 2. Agenda (1/2) 2 1. But why?? 2. Git refresher 3. So what’s the issue? 4. Four golden rules
  3. 3. Agenda (2/2) 3 5. Tools A. Spreadsheet Compare B. xltrail C. Git XL D. Git LFS E. Git clients 6. Merge conflicts A. Single branch workflow: File locking B. Multi branch workflow
  4. 4. About us
  5. 5. Innovative Solutions for Microsoft Excel A small team with a big mission 5
  6. 6. xlwings 6 • Python for Excel • Scripts, UDFs, Macros, REST API • Windows & Mac (except UDFs) • Free & open-source • New: Professional support plans
  7. 7. xltrail 7 • Version control for Excel • Tracks formulas and VBA code
  8. 8. • Local Git extension that makes git diff and git merge work with VBA code (only) • Free & open-source Git XL 8
  9. 9. xlwings CI 9 Continuous integration for Excel files • Write unit tests for Excel files with xlwings • Run them automatically on the server after pushing changes to your Git repo Example: Gitlab Pipeline
  10. 10. xlwings-reports (coming soon) 10 Template Report create_report()
  11. 11. 1. But why??
  12. 12. Look familiar? 12
  13. 13. A few more reasons 13 • Excel files are code, so treat them as such • Git is battle tested • Collaboration • Audit trail / Spreadsheet governance • Peer review / Approval process • Reduce errors
  14. 14. 2. Git refresher
  15. 15. The most important commands 15 • git diff • git add Book1.xlsm • git commit –m ”changed some things” • git push origin master • git pull
  16. 16. 3. So what’s the issue?
  17. 17. 1) Git doesn’t understand Excel 17
  18. 18. 2) GitHub doesn’t understand Excel 18 and GitLab/BitBucket/Azure DevOps are no better
  19. 19. 3) Heavy Excel files 19 • Git transfers the entire commit history of the repository during the cloning process. • As an example: Committing a 25 MB workbook once per day during weekdays will lead to 7 GB repo at the end of the year
  20. 20. 4) Merge conflicts 20 Compared to text files, merge conflicts with Excel files: • Happen way more often • Are harder to resolve
  21. 21. 4. Four golden rules
  22. 22. 1) No more versioned file names! 22 Financial Model_v1.xlsb Financial Model.xlsb
  23. 23. 2) Make use of commit messages 23
  24. 24. 3) Add temp files to .gitignore 24 The .gitignore file prevents certain files to be accidentally added/pushed to Git. To filter out temporary Excel files, add this to your .gitignore file: ~$*.xl* Otherwise you’ll end up sooner or later like this:
  25. 25. 4) Release a version via “git tag” 25 Release asset/artefact (not part of Git repo!!) It’s OK to include version stamps in released files (this can be automated via a continuous integration service like the new GitHub actions).
  26. 26. 5. Tools
  27. 27. A. Spreadsheet Compare
  28. 28. Spreadsheet Compare 28 • Compares 2 Excel files • Standalone desktop app (also integrated into the Inquire Excel add-in) • Part of Office Professional Plus and Office 365 ProPlus • You can integrate it with Git: https://www.xltrail.com/blog/git-diff-spreadsheetcompare
  29. 29. Sheet comparison 29
  30. 30. VBA comparison 30
  31. 31. B. xltrail
  32. 32. xltrail 32 • Free trial: https://www.xltrail.com • xltrail syncs with any Git provider • Alternatively, it works via Drag and Drop and manages Git behind the scenes • Allows comparisons across branches, between any two versions
  33. 33. Summary across sheets and VBA 33
  34. 34. Sheet in context 34
  35. 35. C. Git XL
  36. 36. Git XL 36 • https://www.xltrail.com/git-xl • Free & open-source local Git extension • Created & maintained by us • It is able to diff & merge (!) VBA code • Windows only at the moment
  37. 37. Git XL: via command line 37
  38. 38. Git XL: via Sourcetree 38 Zero configuration required!
  39. 39. Git XL: VBA merging 39 • Git XL merges VBA directly in the VBA Editor • Conflicts get highlighted like this:
  40. 40. D. Git LFS (Large File Storage)
  41. 41. Git LFS intro 41 • https://git-lfs.github.com • Free & open-source local Git extension • Large files are downloaded during “git checkout” rather than during “git clone/git fetch” • On the server side, you need to make sure that it is supported & enabled • git lfs track "*.xl*" • Side note: Since Git 2.18 (June 2018), there’s an “emerging feature” built into Git directly that is called “partial clone”: https://git-scm.com/docs/partial-clone
  42. 42. Git LFS in action 42 • All standard Git commands like git pull/push work automatically with LFS behind the scene
  43. 43. E. Git clients
  44. 44. Git clients 44 Git offers various clients to interact with the remote: • Command Line • Desktop clients (e.g. GitHub Desktop, Sourcetree). For an overview: https://git-scm.com/downloads/guis • File explorer integration: https://tortoisegit.org • Integration with IDE/Text Editor (e.g. VSCode) • Drag and Drop directly on GitHub, GitLab, Azure DevOps (but not Bitbucket)
  45. 45. 6. Merge conflicts
  46. 46. Merge conflicts will bite you! 46 They also happen: • with a single master branch • with a single user For example: • You commit during the day at work. In the evening, you continue at home and forget to pull before you make a new commit.
  47. 47. How do merge conflicts happen 47 True merges always cause a merge conflict (with Excel Files) Fast-forward merges never cause a merge conflict
  48. 48. A. Single branch workflow: File locking
  49. 49. Informal file locking 49 • Similar to shared drives or SharePoint • This prevents the merge conflict altogether • Easy solution: @team I am going to update Model.xlsm Let me know when you’re done, I need it for 5 min. All yours. Thanks, let me pull.
  50. 50. Git LFS file locking 50 • Git LFS offers file locking (introduced with v2.0) • Meanwhile, all major providers support it • A caveat of the file locking is that you need to remember two things: –Actually lock the file –Start with a “git pull” before you edit the file • git lfs track "*.xl*" --lockable
  51. 51. Git LFS file locking: commands 51 User: fzumstein User: jenny
  52. 52. B. Multi branch workflow
  53. 53. Merge two branches 53 • We want to merge ”mybranch” into “master” • We end up in a merge conflict:
  54. 54. git mergetool to the rescue 54 • A simple way to get the files from both branches next to each other is via “git mergetool” – then cancel with Ctrl-C. • This will add 4 files: master mybranch
  55. 55. Resolve the merge conflict 55 • Now compare “contact_list.xlsm” (master) with “contact_list_REMOTE.xlsm” (mybranch) • Spreadsheet Compare or xltrail will be helpful with that • Manually apply the changes you want from mybranch in your master version • Then resolve the merge conflict via “git add” and “git commit”.
  56. 56. Thank You Let’s connect: https://www.linkedin.com/in/felix-zumstein More material: https://www.xltrail.com/blog

×