Skip to content

Commit cb50055

Browse files
2 parents 519aa33 + c82d3be commit cb50055

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

script.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ fi
114114
cd "$backup_path"
115115
git add .
116116
git commit -m "$commit_message"
117+
# Check if HEAD still matches remote (Means there are no updates to push) and create a empty commit just informing that there are no new updates to push
118+
if [[ $(git rev-parse HEAD) == $(git ls-remote $(git rev-parse --abbrev-ref @{u} 2>/dev/null | sed 's/\// /g') | cut -f1) ]]; then
119+
git commit --allow-empty -m "$commit_message - No new changes pushed"
120+
fi
117121
git push -u origin "$branch_name"
118122

119123
# Remove files except .git folder after backup so that any file deletions can be logged on next backup

0 commit comments

Comments
 (0)