Repository navigation
Conversation
4 tasks done
Automatically initialize a git repo and commit after every journal write when the per-journal `git: true` or global `backup_all_jrnls_with_git` config key is set. Optionally push to the first configured remote with `auto_push_to_git_remote_after_edit: true`. Supports both file and folder journals. Adds GitPython dependency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pull from the configured remote before reading journal entries so that changes made on other machines are incorporated automatically. Controlled by a new `auto_pull_from_git_remote_before_edit` config key (global or per-journal, default false). On merge conflicts the pull raises a JrnlException directing the user to resolve manually. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace git pull with fetch + fast-forward for better performance. The common "already up to date" case now only updates remote refs without touching the working tree. Diverged histories raise a clear error instead of attempting a merge. Add --git/--no-git CLI flags to enable or disable all git operations (commit, pull, push) for a single invocation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add config reference entries for backup_all_jrnls_with_git, git, auto_pull_from_git_remote_before_edit, and auto_push_to_git_remote_after_edit. Document --git/--no-git CLI flags and add a Git Integration section to advanced usage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…port) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The --git/--no-git CLI flags added git_enabled to parsed args but the test helper was missing it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jrnl/journals/__init__.py re-exports the Journal class as
jrnl.journals.Journal, shadowing the module of the same name.
patch("jrnl.journals.Journal.git_auto_commit") resolved to the class
on Python 3.10, causing AttributeError. Use patch.object with an
explicit module reference via sys.modules to avoid the ambiguity.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Convert Path to str in repo.git.add() and repo.index.add() calls for compatibility with older GitPython on Python 3.10 - Use explicit refspec in push to avoid push.default issues on macOS - Improve error assertion messages in BDD tests to show stderr/stdout Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
repo.index.add() calls os.getcwd() internally, which fails under pytest-xdist on macOS when a parallel worker's CWD has been deleted by another test's cleanup. repo.git.add() runs git as a subprocess and avoids this issue. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a config is originally loaded from JSON (e.g., during v1.x
upgrade), ruamel's round-trip YAML loader marks every mapping with
flow style. This causes save_config to write the file starting with
'{', which is_config_json() mistakes for a legacy v1.x config,
triggering a re-upgrade on the next run and producing empty output.
Recursively clear flow style on all CommentedMap/CommentedSeq nodes
before dumping to ensure block-style YAML output.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Git marks pack-file objects as read-only, which causes shutil.rmtree to fail with PermissionError on Windows. Add an onerror handler that clears the read-only flag before retry. Also close the repo before cleanup to release file handles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
alichtman
force-pushed
the
git_autocommit_and_push_integration
branch
from
August 8, 2026 23:24
e0ccc1c to
d20c118
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #921. I, like some others that use jrnl, have a git repo backing my jrnls up to a remote git repo. This allows me to sync my jrnls across multiple machines. It is currently a manual process, and this PR adds some infra to automate it + configure it.
This also unblocks the addition of jrnl mobile apps, which will rely on a remote git repo for syncing across devices.
Supersedes #2062 (moved from a fork branch to a branch on this repo now that I'm a maintainer here).
Summary
Test plan
Checklist
for the same issue.