list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <>
Cc: evandrocoan <>
Subject: "git push --recurse-submodules=on-demand" regression
Date: Tue, 27 Jun 2017 09:23:07 -0700	[thread overview]
Message-ID: <> (raw)

From: evandrocoan <>

Originally posted on:

My git version is:
git --version --build-options

git version
built from commit: eba7af3dbb4c846c6303c5f64102acee696c9ab0
sizeof-long: 4
machine: x86

cmd.exe /c ver
Microsoft Windows [Version 10.0.15063]

Before the `git version 2.13`, everything was perfect around here, but now with this version they broke my workflow:

Push: process for submodule 'Packages/Advanced CSV' failed
D:\SublimeText\Data> git.exe push --porcelain --progress --tags --recurse-submodules=on-demand origin refs/heads/develop:refs/heads/develop
src refspec 'refs/heads/develop' must name a ref
process for submodule 'Packages/Advanced CSV' failed

It looks like the git push recurse-submodules behavior has changed.
Currently with 2.13 you cannot run "git push
--recurse-submodules=on-demand" if the parent repo is on a different
branch than the sub repos, e.g. parent repo is on "develop" and
sub-repo on "master".
I was under the impression that Jonathan and may be others considered
the fact that `git push --recurse-submodules=on-demand` doesn't work
as before an unintentional change. He asked me previously if pushing
without a refspec will work for us and I responded with a yes. The
question remains if everyone is on board with change push without
refspec to use `push.default` in the parent repo as well as


git push recurse.submodules behavior changed in 2.13

I did not understand the last part `without refspec to use push.default in the parent repo as well
as submodules`, is it a way to `git push --recurse-submodules=on-demand` when the parent repo is on
the `develop` branch and the submodules are on the `master` branch?

If it is not, how can I do `git push --recurse-submodules=on-demand` when the parent repo is on the
`develop` branch, but the submodules are on the `master` branch with this new git version?

What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example
this will help us understand the issue.

1. You need create a main repository
2. Add a git submodule to it and checkout on the master branch
3. Go to your main repository and add the master branch.
4. Go to the submodule and commit some changes on its master branch, but do not push them.
5. Go to the main repository and commit the submodule head pointer change.
6. Go to the main repository and run the command `git.exe push --recurse-submodules=on-demand`

This shell script creates some repositories and remotes which reproduce the problem:

# Create the directory structure
rm -r -f main_repo
rm -r -f main_repo_remote
rm -r -f submodule_remote

mkdir main_repo_remote
mkdir submodule_remote
mkdir main_repo
mkdir main_repo/first_submodule

cd main_repo

# Setup the first_submodule
cd first_submodule
printf "# Submodule Repository\n\n" >
git init
git add
git commit -m "Added the repository first commit."

git init --bare ../../submodule_remote
git remote add origin ../../submodule_remote
git push origin master

# Setup the main_repo
cd ..
printf "# Main Repo\n\nThis is the main repository which contains submodules\n" >
git init
git add
git submodule add -- "first_submodule"
git commit -m "Added the main repository first commit."

git init --bare ../main_repo_remote
git remote add origin ../main_repo_remote
git push origin master
git checkout -b develop
git push origin develop

# Add an unpushed commit to the submodule
cd first_submodule
printf "Dirty\n\n" >>
git add
git commit -m "Added the repository second commit."

# Go to the main repository and do the push
cd ..
git add first_submodule
git commit -m "Added the main repository second commit."
git push --recurse-submodules=on-demand --set-upstream origin develop

At its last line, I am doing the push on the main repo, but it is failing on the new git version.
Currently the solution is to open the submodules which need to be pushed and push them before to
push the main repository. The problem is that the `--recurse-submodules=on-demand` should work, but
it is not.

What did you expect to occur after running these commands?
I expect to the main repository and the submodule to be pushed to the its remote branch.

What actually happened instead?
After git version `2.13` I see the error `src refspec 'refs/heads/develop' must name a ref`

If the problem was occurring with a specific repository, can you provide the URL to that repository
to help us with testing?

This issue happens mostly with my repository on its develop branch:

Which has about 73 git submodules, checkout on the master branch, while the main repository is
checkout on the develop branch.

                 reply	other threads:[~2017-06-27 16:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).