Facing some wired issue while working with 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
When i run this above script from Jenkins job, it shows git log output fine, but nothing for git shortlog
. Whats the issue? MyApp has hundreds of commits.
Finally I was able to find the reason, git shortlog
works fine when you directly use from terminal because,
git help shortlog
Shows,
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.
So you must provide the reference explicitly while working with shell scripts,
git shortlog HEAD
Will work fine in that case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With