So far, the mobile Git clients are a bit freewheeling, making odd changes and then committing them. When this happens, it’s a bit of a pain to fix, but it’s not impossible.

  1. Turn off automatic syncing in GitSync on phones
  2. Find the last good commit hash in git log or on Forgejo
  3. Run git reset --hard <commit-hash>
    • Confirm that the history looks good with git log
  4. Force push with git push origin +main
    • This is preferable to git push -f because it only forces a push on the specified branch. If only one branch has an upstream tracking branch, the result is identical. If multiple branches have upstream tracking branches, only the specified one will force push. In GitSync on phones:
  5. Switch to “Client mode” in the dropdown under the recent commits
  6. Fetch origin to get the newly clean origin on the phone In PuppyGit on phones:
  7. Tap the branch name on the repo
  8. Tap-and-hold the remote branch (origin/main)
  9. Select reset and then choose “Hard”
    • This takes about 30-45 seconds to complete and will show a toast at the bottom when finished In GitSync on phones:
  10. Confirm clean history
    • This means that none of the commits will have colored backgrounds. (Blue background means local commit that has not been pushed; orange background means remote commit that is not in local branch)
  11. Switch back to sync mode
  12. Re-enable automatic syncing

Since desktop Obsidian only syncs while the app is open, only desktops that have had Obsidian opened since the problem commits were pushed need to be fixed. These are relatively easy to fix.

After the correct commits are on the remote:

  1. git fetch to get the good remote branch
  2. git reset --hard origin/main with the local main branch checked out to make it mirror the remote main