From e542c1e60a7b6004af1603e770fef77c4d952665 Mon Sep 17 00:00:00 2001 From: typebrook Date: Tue, 17 Mar 2020 17:55:20 +0800 Subject: Improve 'gist push' - Allow directly push if commit is ready - Only push when current commit is ahead --- gist | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gist b/gist index 13a6667..2f0d185 100755 --- a/gist +++ b/gist @@ -514,7 +514,12 @@ _push_to_remote() { _gist_id "$1" cd "$folder/$GIST_ID" || return 1 fi - git add . && git commit -m 'update' && git push origin master + if [[ -n $(git status --short) ]]; then + git add . && git commit -m 'update' + fi + if [[ -n $(git cherry) ]]; then + git push origin master + fi } # Set filename/description/permission for a new gist -- cgit v1.2.3-70-g09d2