Git shortlog 不在 Jenkins shell 中显示输出

标签 git jenkins terminal command-line-interface git-log

在使用 Jenkins 时遇到一些连线问题,

#!/bin/sh

set -x

#initialize environment
export PATH="$HOME/.gem/ruby/2.0.0/bin:$PATH"
export PATH="$HOME/.fastlane/bin:$PATH"
export LC_CTYPE=en_US.UTF-8

cd ~/autobuild/projects/MyAPP
git checkout dev
git reset head --hard
git pull

git shortlog

git log

当我从 Jenkins 作业运行上面的脚本时,它显示 git log 输出正常,但没有显示 git shortlog。有什么问题吗? MyApp 有数百次提交。

最佳答案

最后我找到了原因,git shortlog 在您直接从终端使用时工作正常,因为,

git help shortlog

节目,

If no revisions are passed on the command line and either standard input is not a terminal or there is no current branch, git shortlog will output a summary of the log read from standard input, without reference to the current repository.

因此在使用 shell 脚本时必须明确提供引用,

git shortlog HEAD

在那种情况下会很好地工作。

关于Git shortlog 不在 Jenkins shell 中显示输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43041659/

相关文章:

powershell - 为什么我可以在 Windows Powershell 中运行 less、grep 和 find?

linux - 如何在 ubuntu 中记录终端击键

docker - Docker容器-端口设置

git - 异步git钩子(Hook)?

visual-studio-2010 - 源代码管理无法访问数据库

git - 如何为 git 中的新分支设置默认上游?

amazon-web-services - 部署时出现 AWS lambda ResourceConflictException

Jenkins 使用 100% CPU

linux - 如何在远程linux屏幕上显示执行结果(通过ssh输入命令)?

Git:将提交发送到另一个分支,以便我可以工作并 merge 回去,而无需(非常慢) checkout ?