【问题标题】:commit submodule using commit details from the parent in appveyor使用 appveyor 中父级的提交详细信息提交子模块
【发布时间】:2017-01-18 14:58:37
【问题描述】:

在 Appveyor 构建中,我尝试使用来自父 repo 的提交详细信息提交子模块,如下所示:

git commit -m $(git --git-dir=../.git log -1 --oneline)

我这样做的原因是因为我有一个静态站点生成器存储库,它将静态内容构建到 GitHub 页面子模块中,当对父存储库的更改被 PR'd 到主分支时,静态内容是自动构建并推送到 GitHub pages 子模块 repo。

无论如何,这在本地的 PowerShell(使用 posh-git)中有效,但是在 Appveyor 中我得到以下信息:

git commit -m $(git --git-dir=../.git log -1 --oneline)
error: unknown option `git-dir=../.git'
usage: git commit [<options>] [--] <pathspec>...

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: git powershell git-submodules appveyor


    【解决方案1】:

    您可以在您的 git 提交消息中使用 $ENV:APPVEYOR_REPO_COMMIT_MESSAGE。

    例如

    git commit -m "'$ENV:APPVEYOR_REPO_COMMIT_MESSAGE'"
    

    这假设您的父 repo 是触发构建的那个。

    您可以在此处使用的 appveyor 环境变量的完整列表:https://www.appveyor.com/docs/environment-variables/

    【讨论】:

    • 谢谢吉姆!请注意,如果您将命令作为 CMD 运行,请使用如下语法:git commit -m "%APPVEYOR_REPO_COMMIT_MESSAGE%"
    猜你喜欢
    • 2013-03-05
    • 2016-01-24
    • 1970-01-01
    • 2013-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多