Skip to content

Commit ba6561e

Browse files
authored
Merge pull request #25 from IRobL/add-syncing
🆕 optionally auto-commit when syncing gists controlled via environment variable `GISTER_AUTO_COMMIT` close #23
2 parents 8fd2782 + e2e632c commit ba6561e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ After that, you may run `gister sync` to fetch all your gists (created and starr
113113

114114
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.
115115

116+
### Configuration
117+
118+
`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.
119+
120+
`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.
121+
116122
### publish
117123

118124
Whenever you want to publish a gist, just use

gister.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,13 @@ sync_gist() {
313313
legit sync > /dev/null
314314
else
315315
if (is_dirty); then
316-
echo "DIRTY $gist_id"
316+
if [ -z $GISTER_AUTO_COMMIT ]; then
317+
echo "DIRTY $gist_id"
318+
else
319+
echo "DIRTY $gist_id, auto committing"
320+
git add . && git commit -m "automated update" &&
321+
git pull > /dev/null && git push > /dev/null
322+
fi
317323
else
318324
git pull > /dev/null && git push > /dev/null
319325
fi

0 commit comments

Comments
 (0)