Coder Social home page Coder Social logo

wordmerge's Introduction

Copyright (c) 2014 Jason Masker [email protected] All rights reserved.

This file is part of wordMerge.

wordMerge is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

wordMerge is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with wordMerge. If not, see http://www.gnu.org/licenses/.

Version 2014-02-08

wordMerge

Overview

wordMerge is a git merge driver for OSX/darwin which can be used to merge Microsoft Word documents using the commercial software Microsoft Office for Mac 2011.

'wordMerge' is the primary driver, a shell script wrapper which passes applescript commands to the 'osascript' command-line tool, included with OS X.

Usage

Copy wordMerge into your path and make it executable.

cp wordMerge /usr/local/bin
chmod 755 /usr/local/bin/wordMerge

Copy the configuration from the included 'gitconfig' into your '~/.gitconfig' global git configuration file. Alternatively, you can issue the following commands:

git config --global merge.wordMerge.name wordMerge
git config --global merge.wordMerge.driver 'wordMerge "$PWD/%O" "$PWD/%A" "$PWD/%B"'
git config --global merge.wordMerge.recursive binary

You will also need to create or modify the 'attributes' file in the 'info' directory of your git repositories to identify the file types that should be merged using the new driver. An example 'attributes' file has been included which includes the following:

*.docx binary
*.dotx binary
*.docx merge=wordMerge
*.dotx merge=wordMerge

Add any other file extensions you would like to merge using Microsoft Word.

When a merge of two files with the identified extensions is required, it will be performed using the newly defined wordMerge driver. Microsoft Word will open the common ancestor and merge the local and remote branches, tracking changes.

The process will pause for the user to accept or reject the tracked changes using the Review panel in Word.

Make any final edits and select 'Yes' or 'No' from the script prompt to indicate if the merge was successful or not. Marking the merge as unsuccessful gives the user an opportunity to pause or cancel the merge process.

Caveats

If there are formatting changes, Microsoft Word cannot merge them and will prompt for which document to use as a base for formatting. Formatting changes to tables, etc. will need to be done manually. When prompted, it is almost always best to choose the formatting for the 'Current Document' and not the 'Target Document.' This is because the merge action in Word is actually performed twice per merge. The common ancestor is opened and first the local branch changes are merged in, followed by the remote branch changes. Though you may be prompted twice, by choosing 'Current Document' each time, you are effectively keeping the formatting of the common ancestor.

Due to the interactive nature of the script, it works best for a regular merge. If you opt to rebase using this merge driver, it will work, but there will be a manual, interactive merge step for each change, which can be a tedious and redundant process.

The script requires tracking the windows open in Microsoft Word and, in order to accomplish this, begins by closing all open documents and saving changes. It is best to close all open documents, or ensure that Microsoft Word is not running prior to beginning a merge. It is a future objective to eliminate this requirement and behavior.

TODO

  • Modify the script to work reliably without first closing all open Word documents.
  • Modify driver for use as a diff driver.

wordmerge's People

Contributors

jasmas avatar

Watchers

James Cloos avatar

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.