diff options
| author | typebrook <typebrook@gmail.com> | 2020-03-17 09:29:29 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-03-17 09:35:33 +0800 |
| commit | 34ffd215585c483c32fbd53c6b7be4645c902963 (patch) | |
| tree | 11058a624fa352e8f17a5c591fd8767338587eaf | |
| parent | 71ab694bb824f0b3305f72ce14e3f30826bb7250 (diff) | |
Improve 'gist push'
Allow empty index if user is already inside repo
| -rwxr-xr-x | gist | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -508,9 +508,11 @@ _import_to_github() { | |||
| 508 | 508 | ||
| 509 | # Simply commit current changes and push to remote | 509 | # Simply commit current changes and push to remote |
| 510 | _push_to_remote() { | 510 | _push_to_remote() { |
| 511 | _gist_id "$1" || return 1 | 511 | if [[ ! `pwd` =~ ^$folder/[0-9a-z]+$ ]]; then |
| 512 | cd "$folder/$GIST_ID" && git add . \ | 512 | _gist_id "$1" |
| 513 | && git commit --allow-empty-message -m '' && git push origin master | 513 | cd "$folder/$GIST_ID" || return 1 |
| 514 | fi | ||
| 515 | git add . && git commit -m 'update' && git push origin master | ||
| 514 | } | 516 | } |
| 515 | 517 | ||
| 516 | # Set filename/description/permission for a new gist | 518 | # Set filename/description/permission for a new gist |