Created
January 18, 2021 17:05
-
-
Save ajitatif/327e1c4a8384a4f2286b920b627ebcb2 to your computer and use it in GitHub Desktop.
A bash script to check if there are any git changes in the first level children of current directory. Only works on the same branch of the local copy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
for game in $(ls -1); do | |
if [[ -d $game ]]; then | |
cd $game | |
git fetch | |
HEADHASH=$(git rev-parse HEAD) | |
REMOTEHASH=$(git rev-parse $(git branch --show-current)@{upstream}) | |
if [ "$HEADHASH" != "$REMOTEHASH" ]; then | |
echo "Updating $game" | |
git pull | |
fi | |
cd .. | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
first thanks go to Christian Engvall for the blog post here: https://www.christianengvall.se/check-for-changes-on-remote-origin-git-repository/