Push local changes in sync script

This commit is contained in:
Martchus 2023-07-23 21:40:14 +02:00
parent bf73f3da9f
commit 31844f8bce
1 changed files with 7 additions and 0 deletions

View File

@ -52,7 +52,14 @@ for dir in ../* ; do
branch_name=$(git -C "$dir" symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
branch_name=${branch_name:-DETACHED}
# try pushing local changes first
if git -C "$dir" push -u all master:master ; then
git -C "$dir" remote update
fi
if output=$(git -C "$dir" status --porcelain) && [[ -z $output ]] && [[ $branch_name == DETACHED || $branch_name == master ]]; then
git -C "$dir" reset --hard origin/master
fi
done