当父repo在这个新的git版本2.13的`develop`分支上时,我怎么能做`git push -recurse-submodules = on-demand`?

时间:2017-06-20 00:26:30

标签: git git-submodules git-push

相关:

  1. Allow the Smartgit Push button to do push --recurse-submodules=on-demand when using git sub module
  2. git version 2.13之前,这里的一切都很完美,但是现在这个版本打破了我的工作流程:

    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
    

    我正在使用Smartgit客户端,现在当我按下按钮时,我收到了上述错误。搜索我发现这是git客户端上的一个新的更新问题:

    1. [smartgit] Push on demand stopped working on SmartGit 17.0.4
    2.   

      看起来git push recurse-submodules行为已经改变。   目前使用2.13你无法运行" git push   --recurse-子模块=点播"如果父回购是不同的   分支比子分区,例如父母回购正在开发"开发"和   在" master"上的子回购。

      ...

        

      我的印象是Jonathan可能会被其他人考虑过   git push --recurse-submodules=on-demand无效的事实   像以前一样无意的改变。他先前问我是否推   没有refspec将为我们工作,我回答是的。该   问题仍然存在,如果每个人都在没有改变推动   refspec在父repo中使用push.default以及   子模块。

           

      干杯,

           

      JS

      git push recurse.submodules behavior changed in 2.13

      我不理解最后一部分without refspec to use push.default in the parent repo as well as submodules,当父代表位于git push --recurse-submodules=on-demand分支且子模块位于develop时,它是master的一种方式吗?分支?

      如果不是,当父代表位于git push --recurse-submodules=on-demand分支上时,我怎么能develop,但子模块位于master分支上,并带有这个新的git版本? / p>

      更新

      我创建了这个脚本,用本地遥控器在本地再现问题:

      # 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" > README.md
      git init
      git add README.md
      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" > README.md
      git init
      git add README.md
      git submodule add -- ../../submodule_remote "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 --set-upstream origin develop
      
      # Add an unpushed commit to the submodule
      cd first_submodule
      printf "Dirty\n\n" >> README.md
      git add README.md
      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
      

      在最后一行,我正在推动主要的回购,但它在新的git版本上失败了。 目前解决方案是手动打开需要推送的子模块,然后推送它们以推送主存储库,因为选项--recurse-submodules=on-demand在主存储库上不起作用。

      这是一个输出示例:

      $ sh create_bug.sh
      Initialized empty Git repository in D:/User/Downloads/test/main_repo/first_submodule/.git/
      [master (root-commit) 69015bb] Added the repository first commit.
       1 file changed, 2 insertions(+)
       create mode 100644 README.md
      Initialized empty Git repository in D:/User/Downloads/test/submodule_remote/
      Counting objects: 3, done.
      Writing objects: 100% (3/3), 249 bytes | 0 bytes/s, done.
      Total 3 (delta 0), reused 0 (delta 0)
      To ../../submodule_remote
       * [new branch]      master -> master
      Initialized empty Git repository in D:/User/Downloads/test/main_repo/.git/
      Adding existing repo at 'first_submodule' to the index
      [master (root-commit) 6af0279] Added the main repository first commit.
       3 files changed, 7 insertions(+)
       create mode 100644 .gitmodules
       create mode 100644 README.md
       create mode 160000 first_submodule
      Initialized empty Git repository in D:/User/Downloads/test/main_repo_remote/
      Counting objects: 4, done.
      Delta compression using up to 4 threads.
      Compressing objects: 100% (4/4), done.
      Writing objects: 100% (4/4), 430 bytes | 0 bytes/s, done.
      Total 4 (delta 0), reused 0 (delta 0)
      To ../main_repo_remote
       * [new branch]      master -> master
      Switched to a new branch 'develop'
      Total 0 (delta 0), reused 0 (delta 0)
      To ../main_repo_remote
       * [new branch]      develop -> develop
      [master 58e7111] Added the repository second commit.
       1 file changed, 2 insertions(+)
      [develop 69f9588] Added the main repository second commit.
       1 file changed, 1 insertion(+), 1 deletion(-)
      fatal: src refspec 'develop' must name a ref
      fatal: process for submodule 'first_submodule' failed
      fatal: The remote end hung up unexpectedly
      

0 个答案:

没有答案