{"id":39608804,"url":"https://github.com/farhan-syah/git-docx","last_synced_at":"2026-01-18T08:02:37.247Z","repository":{"id":254049278,"uuid":"845318082","full_name":"farhan-syah/git-docx","owner":"farhan-syah","description":"Make viewing difference of .docx files easier","archived":false,"fork":false,"pushed_at":"2024-08-21T04:43:04.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-22T04:55:47.202Z","etag":null,"topics":["docx","git","office","word"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/farhan-syah.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-21T02:42:52.000Z","updated_at":"2024-08-21T04:43:07.000Z","dependencies_parsed_at":"2024-08-21T05:08:49.710Z","dependency_job_id":null,"html_url":"https://github.com/farhan-syah/git-docx","commit_stats":null,"previous_names":["farhan-syah/git-docx"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/farhan-syah/git-docx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farhan-syah%2Fgit-docx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farhan-syah%2Fgit-docx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farhan-syah%2Fgit-docx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farhan-syah%2Fgit-docx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farhan-syah","download_url":"https://codeload.github.com/farhan-syah/git-docx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farhan-syah%2Fgit-docx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28533758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docx","git","office","word"],"created_at":"2026-01-18T08:02:36.637Z","updated_at":"2026-01-18T08:02:37.239Z","avatar_url":"https://github.com/farhan-syah.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Using Microsoft Word (.docx) with Git\n\nInspired by:\n\n- [Integrate git diffs with word docx files](https://github.com/vigente/gerardus/wiki/Integrate-git-diffs-with-word-docx-files)\n\n### Limitation of .docx Files\n\nAlthough we can use `git` to track changes in almost any file, including binary files like `.docx` files, it is difficult to visualize the changes made to these files.\n\nI’ve put together simple instructions that you can use to visualize changes using `git diffs`.\n\n### What Does This Do?\n\n- Add pre-commit and post-commit hooks to keep a Markdown (.md) copy of all `.docx` files inside this repository. This allows you to use `git diffs` to show the changes in the document, which can be viewed in the terminal, on the repository's commit page, in emails, or in other places that support `git diffs`.\n\n### Requirements\n\n- You must install Pandoc (https://pandoc.org/) on your machine. Run `pandoc -v` in your terminal to check if it is available.\n\n### Usage\n\n1. Clone this repository:\n\n   It is recommended to include `--depth=1` so your new repository will have a fresh history.\n\n   Replace `FOLDER_NAME` with your directory name:\n\n   ```bash\n   git clone --depth=1 https://github.com/farhan-syah/git-docx.git FOLDER_NAME\n   cd FOLDER_NAME\n   ```\n\n2. Copy the hooks into the `.git/hooks` directory:\n\n   ```bash\n   cp -R hooks/* .git/hooks/\n   ```\n\n3. Update the local Git configuration to enable Pandoc-based diffs for `.docx` files and add a useful alias for word-diff:\n\n   Run the following commands inside the repository to update the local Git configuration:\n\n   ```bash\n   git config diff.pandoc.textconv \"pandoc --to=markdown\"\n   git config diff.pandoc.prompt false\n   git config alias.wdiff \"diff --word-diff=color --unified=1\"\n   ```\n\n   These settings will:\n\n   - Convert `.docx` files to Markdown when generating diffs.\n   - Disable the prompt when using Pandoc for diffs.\n   - Create a `wdiff` alias for word-diff mode with colored output.\n\n4. Create or modify the `.docx` files using proper `.docx` software, like Microsoft Word or LibreOffice.\n\n   **WARNING:** Do not create or modify the `.docx` files using terminal or common text editors that have no `.docx` support, as it will break the file and `pandoc` will fail to read it. Remember, `.docx` is a binary file and not a normal text file.\n\n   For UNSTAGED changes, you can view the difference directly by using `git wdiff`. Please note that you'll see empty file when running this command on staged or commited files.:\n\n   ```bash\n   git wdiff FILENAME.docx\n   ```\n\n   or you can simpy use `git gui blame` for both STAGED or UNSTAGED:\n\n   ```bash\n   git gui blame FILENAME.docx\n   ```\n\n5. Stage and commit the files:\n\n   ```bash\n   git add FILENAME.docx\n   git commit -m \"Amend FILENAME.docx\"\n   ```\n\n   When you stage the documents and create a new commit, a copy of the files in `.md` will be created/updated, and you can utilize git tools to view the changes.\n\n### View File Changes\n\nTo view the history of changes made to the `.md` files (which are the Markdown copies of your `.docx` files), you can use a few different Git commands. Here’s how:\n\n1. **Using `git log` to View the History**\n\n   The `git log` command is the most straightforward way to view the commit history of a file:\n\n   ```bash\n   git log -- FILENAME.md\n   ```\n\n   Replace `FILENAME.md` with the name of the Markdown file you want to inspect. This command will show the commit history for that specific file.\n\n2. **Viewing Differences with `git log -p`**\n\n   If you want to see the actual changes made to the file in each commit, you can use:\n\n   ```bash\n   git log -p -- FILENAME.md\n   ```\n\n   This will show you the commit messages along with the differences introduced in each commit.\n\n3. **Using `git diff` to Compare Versions**\n\n   If you know the specific commits or branches you want to compare, you can use `git diff`:\n\n   ```bash\n   git diff COMMIT1 COMMIT2 -- FILENAME.md\n   ```\n\n   Replace `COMMIT1` and `COMMIT2` with the commit hashes or branch names you want to compare. This will show you the changes between the two versions of the file.\n\n4. **Using `git wdiff` for Word-Level Diffs**\n\n   If you set up the `wdiff` alias (as previously discussed), you can use it to view word-level differences in the `.docx` files:\n\n   ```bash\n   git wdiff COMMIT1 COMMIT2 -- FILENAME.docx\n   ```\n\n   This will give you a more granular view of the changes, highlighting individual word changes within the lines.\n\n5. **Viewing History in a GUI**\n\n   If you prefer a graphical interface, you can use tools like `gitk`, `GitHub Desktop`, `VSCode Git Extensions` or any Git client that supports visual diffs. For example:\n\n   ```bash\n   gitk FILENAME.md\n   ```\n\n   This command opens a graphical history viewer for the specific file, showing commits and diffs visually.\n\n### Summary of Commands:\n\n- View commit history: `git log -- FILENAME.md`\n- View commit history with diffs: `git log -p -- FILENAME.md`\n- Compare two versions: `git diff COMMIT1 COMMIT2 -- FILENAME.md`\n- Word-level diffs: `git wdiff COMMIT1 COMMIT2 -- FILENAME.docx`\n- GUI view (gitk): `gitk FILENAME.docx` or `gitk FILENAME.md`\n- GUI view (git gui): `git gui blame FILENAME.docx` or `git gui blame FILENAME.md`\n\nThese commands will help you track and inspect the history of changes made to your Markdown files in the repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarhan-syah%2Fgit-docx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarhan-syah%2Fgit-docx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarhan-syah%2Fgit-docx/lists"}