I occasionally rebase my submodules. I realize the danger (historical submodule pointers could point to commits that get garbage-collected away) so I always create and push a tag before the rebase, to make sure the old commits will never get purged. I believe this is safe, based on some experiments I’ve run. The issue: I set the config var push.recurseSubmodules=check, and it seems to insist on having a branch and not merely a tag. When I push the parent repo’s commits, I get failures: "The following submodule paths contain changes that can not be found on any remote”. This is overly pessimistic: the commits are there on the remote, and the tag demonstrates that. Expected behavior: when the submodule remote has a branch or a tag with the submodule pointer as ancestor, the push.recurseSubmodules=check should succeed. Actual behavior: the push.recurseSubmodules=check fails when only a tag, and not any branch, contains the specific commit hash. I’m using Git 2.18.0, but I’ve checked newer Release Notes and didn’t see anything. Below is a Makefile that demonstrates the unexpected failure. The “pre-rebase” tag should be sufficient to allow the check to succeed. Run this in an empty directory. ---- .PHONY: all clean # Make sure no config settings, either /etc/gitconfig or ~/.gitconfig, # affect this experiment. We will create our own ./.gitconfig. GIT := GIT_CONFIG_NOSYSTEM=1 HOME=$(PWD) XDG_CONFIG_HOME= git all: # Configure globally (into ./.gitconfig) $(GIT) config --global user.email "you@xxxxxxxxxxx" $(GIT) config --global user.name "Your Name" $(GIT) config --global push.recurseSubmodules check # Create upstream repos mkdir sub.git && cd sub.git && $(GIT) init --bare mkdir repo.git && cd repo.git && $(GIT) init --bare # Create local repos $(GIT) clone repo.git repo $(GIT) clone sub.git sub # Populate submodule cd sub && echo "foo" > foo && $(GIT) add foo && $(GIT) commit -m 'rev 1 of foo' && $(GIT) push # Add submodule to parent repo cd repo && $(GIT) submodule add ../sub.git && $(GIT) commit -m 'Add submodule' && $(GIT) push # Track a new branch in the submodule cd repo/sub && $(GIT) checkout -b aril && $(GIT) push -u origin aril # Add commits to sub repo cd repo/sub && echo "bar" > bar && $(GIT) add bar && $(GIT) commit -m 'Add bar' && $(GIT) push cd repo/sub && echo "foo2" >> foo && $(GIT) commit -am 'Add more to foo' && $(GIT) push # Update parent with new submodule commits. Note: no push cd repo && $(GIT) add sub && $(GIT) commit -m 'Update sub' # Sub's master branch diverges cd sub && echo "three" > three && $(GIT) add three && $(GIT) commit -m 'Add three' && $(GIT) push # Rebase submodule: this tag is enough to keep the old commits from being garbage collected cd repo/sub && $(GIT) tag pre-rebase && $(GIT) push --tags origin cd repo/sub && $(GIT) checkout master && $(GIT) pull --ff-only cd repo/sub && $(GIT) checkout aril cd repo/sub && $(GIT) rebase master && $(GIT) push --force-with-lease # Update parent repo with newly rebased sub: this will FAIL due to push.recurseSubmodules=check unable to find HEAD^'s submodule pointer in any pushed branch in repo/sub cd repo && $(GIT) add sub && $(GIT) commit -m 'Add rebased submodule' && $(GIT) push clean: rm -rf repo repo2 repo.git sub sub.git .gitconfig