Rubberduck: How to use Rubberduck along with Git

Created on 1 Mar 2021  路  5Comments  路  Source: rubberduck-vba/Rubberduck

Hello! How to use Rubberduck along with Git? Is there any CLI? I want to restrict any commits with ugly code.

support

Most helpful comment

Matt made a good blog post about this https://rubberduckvba.wordpress.com/2020/12/11/sync-project-with-files/

I personally commit both the raw VBA source code files and the workbook when I save it (but not any temporary files). It's usually considered bad practice to upload a binary file, but until someone finds a way to automatically create xlsm files from VBA source, it's useful to have a "compiled" version of my code available for download.

All 5 comments

Currently, there is no direct git integration. What Rubberduck provides is a method to export an entire project into a folder, reachable e.g. via the context menu of the code explorer, and several methods to import/sync files. There is a plain import command allowing to import multiple files. In addition there are the two sync commands, again reachable via the CE. The update command will import or overwrite from the selected files, i.e. already existing modules/classes will be replaced, but other modules will be left as-is. The replace command, on the other hand, will delete all modules/classes from the project and load the selected files instead. The exception are document modules since these can neither be created nor deleted from the VBE. Here, we only update the code.

Matt made a good blog post about this https://rubberduckvba.wordpress.com/2020/12/11/sync-project-with-files/

I personally commit both the raw VBA source code files and the workbook when I save it (but not any temporary files). It's usually considered bad practice to upload a binary file, but until someone finds a way to automatically create xlsm files from VBA source, it's useful to have a "compiled" version of my code available for download.

Hi all !
I apologize for this old boring question...
I have a couple UserForms in a VBA project.
Whenever I "export project", these UserForms are always seen as modified in version control (git), even if they really aren't.
There seems to be something volatile in these components or, better, in the binary file of these components (frx), since the code text file (frm) is unchanged. How could this behavior be managed? (is it possible to manage it?)

@gicif there's a bug in the VBIDE API with importing/exporting UserForm modules; it inserts a new empty line at the top every time - in principle Rubberduck's export commands "fix" this by removing that extra line, so if the diff isn't showing it then it's something else.

The .frx would be modified whenever anything changes in the designer, and IIRC there's just no telling how the VBIDE API is going to export that file: it's not impossible that it's indeed different every time if controls and their properties serialize in a somehow non-deterministic way.

If the .frx diff is pure noise, consider undoing changes in .frx files before committing.

it's not impossible that it's indeed different every time if controls and their properties serialize in a somehow non-deterministic way.

This is indeed the case. I open the project, export it, close the project without saving anything. I reopen the project and re-export it. I compare the two frx (with a hex viewer) and they are different. I repeat everything and they are always different, even from the first time (other hex values).

If the .frx diff is pure noise, consider undoing changes in .frx files before committing.

Thanks Matt, for the tip, I'll try it!

Was this page helpful?
0 / 5 - 0 ratings