Skip to content

Instantly share code, notes, and snippets.

@KyWa
Created June 28, 2021 22:05
Show Gist options
  • Save KyWa/0aec6804ea8ba2355e858f45967e926f to your computer and use it in GitHub Desktop.
Save KyWa/0aec6804ea8ba2355e858f45967e926f to your computer and use it in GitHub Desktop.
basic git check
#!/bin/bash
repodir="/home/user/repo"
check_git() {
cd $repodir
current="cat .git/FETCH_HEAD | awk '{print $1}'"
git pull
pulled="cat .git/FETCH_HEAD | awk '{print $1}'"
if [ $current = $pulled ];then
do_thing
else
exit
fi
}
do_thing() {
podman build
do yo thang
}
check_git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment