# Git - Coexisting with a Background Auto-Committer A background auto-committer, such as the Obsidian git-sync plugin, is a second writer in your repository. It stages, commits, and pulls while you work. Ordinary add, commit, rebase, and pull flows race it and fail in confusing ways. The working discipline is pathspec-scoped commits, index hygiene, and read-only checks before you react. ## Key points - An auto-committer commits while you diagnose. This is why `git rebase --continue` later reports "nothing to commit, working tree clean": HEAD already had the correct content, and the sequencer only needed to finalize. - A scoped `git commit` commits everything the background writer has staged. The pre-staged index, not your `git add`, defines the payload. Soft-reset, restage only the intended files, and recommit while the commit is still local and unpushed. - A pathspec-scoped commit (`git commit -S -- <exact tracked paths>`) without `git add` keeps pre-staged background changes out of the commit and does not race the auto-commit. - A rebase left mid-replay while backup automation commits on top corrupts the rebase todo with a duplicated pick. `git pull` then refuses until the `rebase-merge` directory is cleared. Recovery is abort plus a single-command replay onto the remote tip. A live-rewritten `.obsidian/workspace.json` between autostash and pick is the recurring breaker. - An "unmerged files" warning at session start can be a leftover index lock, not a content conflict. Empty `git ls-files -u` output proves that no unmerged stage entries exist. - A pull race can delete tracked files that a just-merged remote change removed. Restore the files from backup, then untrack and ignore them. A backup alone does not protect tracked files the remote deletes. - File-level sync tools such as Syncthing replicate `.git` without git awareness. If they sync `.git/objects/pack/` during a `git gc` or `git fetch`, conflict copies corrupt the multi-pack-index. Exclude `.git/` from sync paths. ## How to apply 1. Check the staged set before you commit. Do not check only your intended file. 2. Commit with a pathspec and no `git add`: `git commit -S -- <exact tracked paths>`. Pre-staged background changes stay out, and you do not race the auto-commit. 3. If a commit already swept background-staged files and is still local and unpushed: soft-reset the commit, stage only the intended files, and commit again. 4. When `git rebase --continue` reports "nothing to commit, working tree clean", trust it. HEAD already has the content. Let the sequencer finalize. 5. When `git pull` refuses because a rebase todo is corrupted: abort the rebase, clear the `rebase-merge` directory if it remains, then replay your commits onto the remote tip in a single command. 6. When a session-start hook warns about unmerged files, run `git ls-files -u` first. Empty output means there is no conflict. Look for a leftover index lock instead. 7. Exclude `.git/` from the sync paths of file-level sync tools such as Syncthing. 8. When a pull deletes tracked files: restore them from backup, untrack them, and add them to the ignore list. ## Observations - [git] A background auto-committer is a concurrent writer: it committed mid-diagnosis, and `git rebase --continue` then reported a clean tree. #concurrency (source: agent sessions, 2026-08) - [git] The pre-staged index, not your `git add`, defines the payload of a scoped commit. #index-hygiene (source: agent sessions, 2026-09) - [git] Pathspec-scoped commits keep background-staged changes out and do not race the auto-commit. #workflow (source: agent sessions, 2026-09) - [git] A rebase left mid-replay while backup automation commits on top corrupts the rebase todo. #recovery (source: agent sessions, 2026-09) - [git] An "unmerged files" warning can be a leftover index lock. Empty `git ls-files -u` output proves there is no conflict. #diagnosis (source: agent sessions, 2026-07) - [git] A pull race deleted tracked files a remote merge removed. Untrack plus ignore protects them, not only a backup. #recovery (source: agent sessions, 2026-10) - [sync] File-level sync of `.git` during `git gc` or `git fetch` corrupts the multi-pack-index through conflict copies. #git (source: agent sessions, 2026-05) ## Relations - relates_to [[resources/documentation/Git - Rebase, Stash, and Recovery]] (the corrupted rebase todo case extends the general recovery playbook) - relates_to [[resources/documentation/Git - Commit Signing with SSH Agents and gitsign]] (the pathspec commit form `git commit -S -- <paths>` relies on the signing setup) - relates_to [[resources/documentation/Agents/Agents - Second Brain with Obsidian and AI]] (the editor setup that runs the background auto-committer) ## Sources - Personal agent-session notes, May 2026 to October 2026