【问题标题】:GIT push all branches in subdirectory to other repoGIT将子目录中的所有分支推送到其他repo
【发布时间】:2017-08-11 08:30:52
【问题描述】:

我们有一个包含多个 GIT 存储库的设置,并希望使用自动化流程进行跟踪

repo1/specificbranch
|-branch1
|-branch2
|-branchn

repo2/organisation/specificbranch
|-branch1
|-branch2
|-branchn

遥控器已经设置好,但我很难弄清楚要执行的命令。

【问题讨论】:

  • 在每条路径中只有一个git push -u origin branchn 还不够吗?
  • 不,我们必须指定源中的子目录以及目标的另一个结构。我以为它会像git push repo2 specificbranch/*:organisation/specificbranch/

标签: git git-branch


【解决方案1】:
for repo_dir in repo1/specificbranch repo2/organisation/specificbranch
do
    pushd $repo_dir
    git push origin --all
    popd
done

【讨论】:

  • 我在 Windows 上。
  • Git-Bash 提供 git 和 bash(forpushdpopd 是 bash 的内置命令)。
猜你喜欢
  • 2019-07-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-21
  • 2023-03-11
  • 2019-02-26
相关资源
最近更新 更多