Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

SourceTree- VBA Macros via xltrail

I have been developing some VBA Macros in Excel and I would like to use revision control to help manage the development.

I have discovered which is an open source Git command line extension: git-diff and git-merge.

It seems to work great from the git command line.  However, I am used to using SourceTree.  Anyone know how I can merge these two together?


Under git I tried system git instead of embedded.  I also tried playing around with the external diff/merge options.  I couldn't seem to get it right.  


xltrail added the following to my .git/config file if this helps.


[diff "xltrail"]
   command = git-xltrail-diff.exe
[merge "xltrail"]
   name = xltrail merge driver for Excel workbooks
   driver = git-xltrail-merge.exe %P %O %A %B


I am a beginner with Git and SourceTree.  Any help would be greatly appreciated.

5 answers

Hi @Mike Corsaro I am one of the maintainers of git-xltrail. I see that it now works with SourceTree 3.0.12. However, I can only see it working in the case of uncommitted changes, not for already committed changes. Is there a simple reason for why that is? We're happy to do changes on our side as per your suggestion but I was wondering if the current behaviour was expected. Thanks for a quick feedback!

I wrote a short blog post about how to use SourceTree with git-xltrail:

0 votes
Mike Corsaro Atlassian Team Jun 12, 2018

Hello! Sourcetree doesn't currently support doing this as we explicitly disallow external diff drivers for specific file types. However, I don't see why we couldn't support this as it's a pretty small change for us to make.

For what it is worth, that would be a huge help to me.


SourceTree is a critical part of my development for all of the other languages I code in.  Being able to use SourceTree for my VBA development would be a huge win.

I still use it, but not being able to use diff and merge limits its usefulness.

Thanks for considering this!

Hey, just wanted to throw my support in for this as well! It would be so nice to be able to use xltrail + Sourcetree's diff viewer.

0 votes
Mike Corsaro Atlassian Team Jun 28, 2018

Just to provide an update on this one -- it's going to take a bit longer than expected due to xltrail not producing a standard git diff:

  • It ignores most diff command switches such as color formatting and mnemonicprefix
  • It outputs as if there are multiple files (which is OK), but doesn't add an additional diff header

Thanks for your patience!

Thanks for the update!


Not trying to hold you to anything.  However, do you have an idea if this might be on the order of weeks, months, etc.?

Mike Corsaro Atlassian Team Jun 28, 2018

Probably in the 2.7 release, which will be coming in the next few weeks.

A couple weeks is pretty good, thanks!

Should those issues be brought up to them? Or do you think you can handle it on your end?

As an aside, I would've thought color formatting is handled by SourceTree?

@Mike CorsaroIs there any update to this out of curiosity? Is it still slated for the next release, and if so do you know when that is coming out?

@Mike Corsaro

I have installed xltrial and it works as intended in the command window as intended.



Unfortunately, it is not showing up in the GUI window as shown here.



I am running version SourceTree version 3.1.2.

Is there something else I am supposed to to in order to get this to work, or are you still working on the patch?

Mike Corsaro Atlassian Team Mar 27, 2019

Seems to work fine for me?


Are you sure you have everything configured?

Open the Process Log (Tools > Process Viewer...), click on the file to generate the diff, and then check the process output. It should look something like this:

[1mdiff --xltrail a/Book1.xlsb b/Book1.xlsb
[1m--- a/Book1.xlsb/VBA/Module/Module1
[1m+++ b/Book1.xlsb/VBA/Module/Module1
[36m@@ -2,3 +2,7 @@
Sub test()
Debug.Print "hello1"
[32m+End Sub

Hey @Mike Corsaro , I think what might happen is that @Kade333 is looking at two historical commits, while you're looking at pending commits (where it works). Is there anything we'll need to change (I am one of the maintainers) to make it work for historic commits, too?

Mike Corsaro Atlassian Team Mar 27, 2019

@fzumsteinnothing you need to do on your side -- looks like 'diff-tree' doesn't have the default diff settings of '--ext-diff' like 'log' and 'diff' does for some reason. I'll add it to our backlog and hopefully it will be included in the next release.

awesome, thanks!

Hey @fzumstein , your blog is great and very helpful. I recently started developing VBA and started to use Sourcetree along with my other Java projects. I can't wait to be able to compare historical diff's.

@Mike Corsaro , Any ETA on the timeline for this?

Mike Corsaro Atlassian Team Apr 30, 2019

It's been fixed in 3.1.3 which is at 25% in our progressive rollout. You can also manually download it here.

Like Ana Retamal likes this

@Mike Corsaro , thanks, I was struggling to make SourceTree (v3.2.6) work with that but couldn't and after I posted a question here it started to work)

Actually I believe there is still a problem in some cases: there is one command (from the logs) that is not calling Git XL and the other command is calling it and producing a proper diff output.

The command #1 that works - as it is in my SourceTree log file:
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks diff-tree --oneline --unified=3 --root -w -M -C --ext-diff 6b4...3b7 -- \"Test_GitXL/Variation.xlsm\"

This command #2 doesn't work with Git XL: 
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks diff --unified=3 -M --no-color -- \"Test_GitXL/Orica Contract Variation.xlsm\"

"Output" of second command is : "diff --git a/Test_GitXL/Variation.xlsm b/Test_GitXL/Variation.xlsm\nindex 0a51..1fec 100644\nBinary files a/Test_GitXL/Variation.xlsm and b/Test_GitXL/Variation.xlsm differ\n"

Output from command #1 is meaningfull diff results...

Possibly I'm missing something in my Git knowledge, can't see why #1 works while #2 doesn't.... difference is that #1 has diff-tree and ext-diff... but what does that mean?

Andrew D

@Mike Corsaro @fzumstein What follows isn't technically an answer, but I figured it would make sense to keep a related beginner xltrail/sourcetree question in the same (and only similar) thread. 

Along similar lines to OP I'm a relative beginner with Git, xltrail, and SourceTree, and I've been playing around with using these tools to manage some xlsm files.

Everything seemed to be working swimmingly, but I ran into some trouble when I edited a VBA module in one of my xlsm files and then observed it in Sourcetree.

2.pngWhen I try to stage or discard lines/hunk, I get the following error:


The content of that file is:

diff --git a/diff_results.xlsm b/diff_results.xlsm

--- a/diff_results.xlsm   

+++ b/diff_results.xlsm

@@ -11,8 +11,8 @@

' Return code?

Call RunPowerShell(cmd, "CompareResults")


[31m-' dummy comment added

[32m+' dummy comment revised after being added

End Sub


 Sub CallCompareResults()

I verified that I could discard hunk with a change to a simple text file, so I think my basic sourcetree and repo setup is right.  Perhaps xltrail doesn't support patching like this?  Or might something else be the problem?

Just to minimize confusion: We have renamed git-xltrail into Git XL and hence all commands are now "git xl" instead of "git xltrail". Everything else stays the same, but during upgrading it might be best to completely uninstall git-xltrail before you upgrade to git-xl.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

3,334 views 4 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you