diff options
| author | typebrook <typebrook@gmail.com> | 2020-03-17 17:55:20 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-03-17 18:12:08 +0800 |
| commit | e542c1e60a7b6004af1603e770fef77c4d952665 (patch) | |
| tree | 65e8cff41af846a51afdbfff0adaba7cbf416c52 | |
| parent | 3f032c01f65b1fbf5d6fb16f4274c17504504f4c (diff) | |
Improve 'gist push'
- Allow directly push if commit is ready
- Only push when current commit is ahead
| -rwxr-xr-x | gist | 7 |
1 files changed, 6 insertions, 1 deletions
| @@ -514,7 +514,12 @@ _push_to_remote() { | |||
| 514 | _gist_id "$1" | 514 | _gist_id "$1" |
| 515 | cd "$folder/$GIST_ID" || return 1 | 515 | cd "$folder/$GIST_ID" || return 1 |
| 516 | fi | 516 | fi |
| 517 | git add . && git commit -m 'update' && git push origin master | 517 | if [[ -n $(git status --short) ]]; then |
| 518 | git add . && git commit -m 'update' | ||
| 519 | fi | ||
| 520 | if [[ -n $(git cherry) ]]; then | ||
| 521 | git push origin master | ||
| 522 | fi | ||
| 518 | } | 523 | } |
| 519 | 524 | ||
| 520 | # Set filename/description/permission for a new gist | 525 | # Set filename/description/permission for a new gist |