Giter Club home page Giter Club logo

wordgit's Introduction

WordGit

A tool that allows you to diff and merge Word (.docx) files with git. Currently Mac only.

Setup

  1. Clone this repository somewhere.
  2. Add the following to ~/.gitconfig:
[difftool "Word"]
  cmd = <PATH TO WORDGIT>/diff.js \"$LOCAL\" \"$REMOTE\"
[mergetool "Word"]
  cmd = <PATH TO WORDGIT>/merge.js \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"

Usage

Diff

  1. In your repository, run git difftool -T Word with any arguments that you would normally pass to git diff.
  2. On your first run, Word may prompt you to open some files so that Word can access them through its sandbox. Do as it says. (If you don't see the diff after doing this step, rerun the command in step 1 and it should work)
  3. Your diff should open in a new document.

Merge

  1. In your repository run git merge, then, if there are conflicts, git mergetool -T Word <path to docx file with conflicts>.
  2. On your first run, Word may prompt you to open some files so that Word can access them through its sandbox. Do as it says.
  3. A new Word doc should open with the changes on both branches added as tracked changes. Merge any differences.
  4. Click the Done button. (On your first run, you may get another sandbox prompt.)
  5. Merge any other files and commit your merge as normal.

FAQ

Will it run on Windows?

No, this is implemented using Apple's scripting support. However, you may be able to use TortoiseGit's Windows implementation of the same feature.

How it works

This whole thing is a careful dance around a bunch of Word bugs, but it seems to work pretty well.

Diff

git difftool runs diff.js as a shebang script, evaluated by osascript (AppleScript). diff.js copies the diffed files to /tmp/word_git (we copy them because Git gives us paths that Word's sandboxing workaround doesn't seem to like). Then we open and close doc2 (Word's sandboxing workaround doesn't seem to trigger when you open a document for diffing, but opening and closing it first sloves that). Finally, we open doc1, run the diff, and close doc1.

Merge

Similar to diff. There's some closing and reopening because for some reason Word doesn't merge properly if we don't.

wordgit's People

Contributors

gaelan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

blochberger

wordgit's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.