If you rely on Excel for your daily work, your folder most likely contains a lot of different versions of the same file like "myfile_final_v2.xlsx" or "myfile_final_final.xlsx" (you don't want to inadvertently mess up your file, do you?).
In case you know how to use Git version control, using it to track your Excel files is an easy decision to make. This will save you from having to rename your files locally all the time and will give you the option to add a commit message so you know what's going on.
However, it won't take long before you'll miss one Git's core functionality: the "Git diff" feature. For Git, an Excel file is just a binary file and you can't see what changed from one version to the other.
Turns out if you use SourceTree, this is now an easy-to-solve problem for your VBA code!
SourceTree is Atlassian's popular free GUI application for Git, made for users who prefer a desktop application over a the command line. Needless to say, SourceTree doesn't behave differently from any other Git platform or GUI client: it doesn't show you diffs for Excel files out of the box:
Let's see how we can fix this!
xltrail is a version control platform for Excel files and works similar like GitHub, BitBucket or GitLab with the difference that xltrail understands the content of Excel files.
While xltrail allows you to integrate with all of these Git providers, it also offers a free and open-source Git extension git-xltrail that allows you to diff and merge your VBA code locally either on the command line or most recently also through SourceTree.
You can download git-xltrail here. Note that you do not have to open an account to be able to use it. After clicking your way through the installer, you can activate the extension either globally for all repos (
git xltrail install) or for specific repositories only (
git xltrail install --local while being in a specific repo). For details see the instructions here.
If you now head over to your command line and run a Git diff command, it'll happily show you what changed in your VBA code:
Once git-xltrail is installed and activated for your repository, head back to SourceTree where you are now able to see uncommitted diffs in your VBA code without having to change anything in the settings: