5

We are using TortoiseGit in my team. There is a shared excel sheet in the repo. When I commit changes and try to push, it says there is a conflict, I pulled and tried to rebase but it says it doesn't support this type of files.

Doesn't have TortoiseGit rebase support excel sheets or non text files?

MrTux
  • 32,350
  • 30
  • 109
  • 146
mowienay
  • 1,264
  • 4
  • 19
  • 32
  • possible duplicate of [Resolving a Git conflict with binary files](http://stackoverflow.com/questions/278081/resolving-a-git-conflict-with-binary-files) – jub0bs Aug 19 '14 at 10:59
  • I viewed the possible duplicate, Jubobs. I don't think it is the same. I need to rebase the file as normal text file to resolve a conflict – mowienay Aug 19 '14 at 11:04
  • 1
    Since Excel files are binary files, merging changes and rebasing is pretty much mission impossible; see also https://github.com/githubtraining/zzz_deprecated-feedback/issues/45 – jub0bs Aug 19 '14 at 11:13
  • 3
    Excel sheets are not normal text files. If it's xlsx, you could unzip them to get 'normal' text files. Still, git will see it as binary. What you could do is extract the two versions and merge the changes, using MS Excel, manually. Then commit that 'manually merged version'. – MicroVirus Aug 19 '14 at 11:13

2 Answers2

6

If you get some excel merge tool, you could set external merge tool in TortoiseGit Settings:

enter image description here

Then, when you get conflict, you could use that tool to merge the file manually.

IIRC, there is no such tool or script. (But, word file has one.)


However, I got a workaround:

  1. copy the diff script command from extension diff program
    enter image description here

  2. paste to extension "merge" program, and modify the argument.
    enter image description here
    (wscript.exe "C:\Program Files\TortoiseGit\Diff-Scripts\diff-xls.js" %mine %theirs //E:javascript)

  3. the log and excel context
    enter image description here

  4. merge test branch to master
    enter image description here

  5. get conflict, and push resolve button
    enter image description here

  6. commit dialog is popup, and double click on excel file to invoke the script
    enter image description here

  7. merge manually
    enter image description here

  8. save to the local file
    enter image description here

  9. mark the file as resolved
    enter image description here

  10. review the merged excel file if you want, then commit

Yue Lin Ho
  • 2,945
  • 26
  • 36
0

You might want to give xltrail client a try, which is a free, open-source Git extension for Excel workbooks: https://github.com/ZoomerAnalytics/git-xltrail (disclaimer, I'm one of the authors).

It installs a custom differ and merger for Excel workbooks to make git diff and git merge work the same way Git works for text files.

It currently works for VBA inside Excel workbooks only, but we are working on making it work for sheets, too. Essentially, when you merge, it'll work out which VBA modules have been deleted, added and modified and applies the standard three-way merge and dumps conflicted code with the standard Git notation into the affected VBA modules (which can then be manually resolved using Excel).

For an example (including a short video), have a look at: https://www.xltrail.com/blog/git-merge-excel-vba

Bjoern Stiel
  • 3,918
  • 1
  • 21
  • 19