Word, as the most pervasive software among the three Office suites, has a lack of automatic file saving and version control. These features can only be accessed with OneDrive, whose software quality is unsatisfactory. For those who have NAS, it is not very cost-effective. Are there any third-party solutions that can help Microsoft solve this problem?
Introduction#
What is Version Control?#
Version control is a system that tracks and manages changes to files. It helps you keep track of changes to files, revert to previous versions, and collaborate on files with others.
There are two main types of version control systems: centralized and distributed. Centralized version control systems store all files on a central server. Distributed version control systems store files on all participants' workstations.
Git#
Git is a distributed version control system and is currently one of the most popular version control systems. It is easy to use and can be used for various projects.
Here are some of the benefits of using version control:
- Track file changes: Version control helps you track changes to files, which is useful for reverting to previous versions or viewing the change history.
- Revert to previous versions: If you accidentally delete or change a file, you can use version control to revert to a previous version.
- Collaborate with others: Version control helps you collaborate on files with others. Everyone can work on their copy of the file and then merge the changes into the main branch.
Pandoc#
Pandoc is a free software that converts text to various formats, including HTML, PDF, LaTeX, EPUB, Docx, and more. It is developed by John MacFarlane and runs on Windows, Mac, and Linux. Pandoc is a widely used tool in academia and technology and can be used for writing and formatting documents, generating presentations, creating e-books, and more.
Powered by Google Bard
Implementation Logic#
Git was initially designed for version control of source code, and it supports plain text content very well. However, binary formats like Docx cannot generate text-level modification records in Git. Although it can still be used, version control cannot be previewed, which is no different from directly naming them as v2 and v3.
Therefore, we use Pandoc to convert Docx to Markdown and use git diff
to let Markdown replace Docx to present the text-level preview version difference comparison.
Operation Steps#
- Install Git and Pandoc
- Configure Git
- Edit Word
- Git Commit
Install Git and Pandoc#
- Go to the Git official website, download and install the Git version corresponding to your operating system.
- Go to the Pandoc official website, download and install the Pandoc version corresponding to your system.
For macOS, it is recommended to use Homebrew to install Git and Pandoc: brew install git pandoc
Configure Git#
- In the User directory, open the
.gitconfig
file and add the following content at the end:
[diff "pandoc"]
textconv=pandoc --to=markdown
prompt = false
[alias]
wdiff = diff --word-diff=color --unified=1
- In the Word folder where we want to perform version control, initialize Git:
git init
- Add
.gitattributes
and add the following content:
*.docx diff=pandoc
Edit Word#
Here, a demonstration document will have its English abstract deleted, and then the file will be saved.
Git Commit#
- By using
git diff {file name}.docx
, we can process the Docx format into Markdown
- In Git GUI Apps like Github Desktop, you can clearly see the changes made to this Docx file
Then you can use commands like Git commit
to perform version control. You can learn more about advanced Git operations on the Git official website.