Hey there,

I have come across a condition that leads to the "loss" of commits.

Please describe the problem.

After merging some branch into an adjusted branch, git annex can no longer sync the adjusted branch with the main branch. git annex sync prints unable to propagate merge commit Ref "XXX" back to Ref "refs/heads/main", however the exit code does not indicate failure.

Based on this statement from the adjust man page:

Re-running this command with the same options while inside the adjusted branch will update the adjusted branch as necessary (eg for --hide-missing and --unlock-present), and will also propagate commits back to the original branch.

I re-adjusted the branch. However, this printed the same warning, but reset the adjusted branch back to main, leading to the loss of all commits only present in the adjusted branch.

What steps will reproduce the problem?

The sequence of commands below reproduces the issue. Create a fresh git-annex repository and create some commit in it. Then create a new branch and adding a commit there. Switch back to the main branch, and adjust it. Merge the new branch into the adjusted branch. Create some more commits in the adjusted branch. Try to sync the adjusted branch with the main branch. git annex sync fails, while git annex adjust leads to the loss of the second and third commit.

# Setup Repo
mkdir test && cd test
git init
git annex init

# Add first data
echo "Some first data" > 01
git annex add 01
git commit -m "Add first data"

# Create adjusted branch
git annex adjust --hide-missing --unlock

# Branch of main and add data
git switch main
git switch -c new
echo "Some second data" > 02
git annex add 02
git commit -m "Add second data"

# Merge new branch into adjusted
git switch "adjusted/main(hidemissing-unlocked)"
git merge new --no-edit

# Add more data to adjusted
echo "Some third data" > 03
git annex add 03
git commit -m "Add third data"

# Try to sync adjusted with main
# This reports "unable to propagate merge commit Ref XXX back to Ref "refs/heads/main"
git annex sync

# Try to sync by re-adjusting
# Also reports the unable to propagate, but also resets "adjusted/main(hidemissing-unlocked)" to the very first commit, loosing two subsequent two
git annex adjust --hide-missing --unlock

What version of git-annex are you using? On what operating system?

Version 10.20250416-X on Linux:

 󰛒 git annex version
git-annex version: 10.20250416-gb22a72cd9444071e86a46cc1eb8799e7d085b49d
build flags: Assistant Webapp Pairing Inotify DBus DesktopNotify TorrentParser MagicMime Benchmark Feeds Testsuite S3 WebDAV
dependency versions: aws-0.24 bloomfilter-2.0.1.2 crypton-0.34 DAV-1.3.4 feed-1.3.2.1 ghc-9.4.8 http-client-0.7.17 persistent-sqlite-2.13.1.0 torrent-10000.1.3 uuid-1.3.16 yesod-1.6.2.1
key/value backends: SHA256E SHA256 SHA512E SHA512 SHA224E SHA224 SHA384E SHA384 SHA3_256E SHA3_256 SHA3_512E SHA3_512 SHA3_224E SHA3_224 SHA3_384E SHA3_384 SKEIN256E SKEIN256 SKEIN512E SKEIN512 BLAKE2B256E BLAKE2B256 BLAKE2B512E BLAKE2B512 BLAKE2B160E BLAKE2B160 BLAKE2B224E BLAKE2B224 BLAKE2B384E BLAKE2B384 BLAKE2BP512E BLAKE2BP512 BLAKE2S256E BLAKE2S256 BLAKE2S160E BLAKE2S160 BLAKE2S224E BLAKE2S224 BLAKE2SP256E BLAKE2SP256 BLAKE2SP224E BLAKE2SP224 SHA1E SHA1 MD5E MD5 WORM URL GITBUNDLE GITMANIFEST VURL X*
remote types: git gcrypt p2p S3 bup directory rsync web bittorrent webdav adb tahoe glacier ddar git-lfs httpalso borg rclone hook external compute mask
operating system: linux x86_64
supported repository versions: 8 9 10
upgrade supported from repository versions: 0 1 2 3 4 5 6 7 8 9 10

But it also occurred on a macOS system, of which I do not have the version at hand.

Please provide any additional information below.

Do you know how I can recover the lost commits?

Have you had any luck using git-annex before?

Git-annex is such a great piece of software, thanks for creating it. I use it to manage my photography archive. I have a main branch that contains all my images and that I sync and backup across various devices. When adding new images to the archive I create a branch just containing those new images. After culling those photos, I merge it into main. Git-annex does a perfect jobs with this. But now I started using some SW that cannot deal with symlinks, so I use an adjusted branch of main. Merging the new import branch into the adjusted branch leads to the described issue.

Many thanks and have a great day!