I wrote a bash script to loop through all git folders and do a git pull
. The issue is there are a lot of folders, and the git pull
command generates a lot of logs for each of them, so that I have to skim through the logs and check if any of them had failures (e.g: some might need a git reset
prior to the pull)
Is there a way to get kind of "success" or "failure" state of git pull
result, then it'd be more concise in the logs, and I can just focus on those that failed and treat them separately.
You can check if git commands were succesful or not.
After a failed git pull
, the exit status would be non-zero, you can check it like this in a shell script :
if /usr/bin/git pull; then
echo "OK"
else
echo "Not Ok"
fi
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