Skip to content

Commit

Permalink
Merge pull request #25 from IRobL/add-syncing
Browse files Browse the repository at this point in the history
🆕 optionally auto-commit when syncing gists

controlled via environment variable `GISTER_AUTO_COMMIT`

close #23
  • Loading branch information
weakish committed Jun 14, 2019
2 parents 8fd2782 + e2e632c commit ba6561e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ After that, you may run `gister sync` to fetch all your gists (created and starr

Warn: `sync` can only fetch up to 10 million gists for you. If you have more than 10 million gists, you need to modify the source of `gister` to lift the limit.

### Configuration

`GISTER_USE_HTTPS`: If you need to use https for some reason, set the env var `GISTER_USE_HTTPS`, but please note this isn't necessarily more secure than ssh, it's just a different option in case your network blocks all traffic other than http/s.

`GISTER_AUTO_COMMIT`: If you'd like the `sync` command to automatically commit any local changes you've made before pulling and pushing to gist.github.com, set the `GISTER_AUTO_COMMIT` env var to anything.

### publish

Whenever you want to publish a gist, just use
Expand Down
8 changes: 7 additions & 1 deletion gister.sh
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,13 @@ sync_gist() {
legit sync > /dev/null
else
if (is_dirty); then
echo "DIRTY $gist_id"
if [ -z $GISTER_AUTO_COMMIT ]; then
echo "DIRTY $gist_id"
else
echo "DIRTY $gist_id, auto committing"
git add . && git commit -m "automated update" &&
git pull > /dev/null && git push > /dev/null
fi
else
git pull > /dev/null && git push > /dev/null
fi
Expand Down

0 comments on commit ba6561e

Please sign in to comment.