Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push local changes to gist #11

Closed
isaaclw opened this issue Aug 5, 2015 · 2 comments
Closed

Push local changes to gist #11

isaaclw opened this issue Aug 5, 2015 · 2 comments

Comments

@isaaclw
Copy link
Contributor

isaaclw commented Aug 5, 2015

Am I missing something? or is there no easy way to push changes from gister?

I wrote this patch:

diff --git a/gister.sh b/gister.sh
index 56b91a5..9d981c0 100755
--- a/gister.sh
+++ b/gister.sh
@@ -221,6 +221,10 @@ sync_gist() {
     local last_updated_unixtime=$(date --date="$gist_updated_at" +"%s")
     local time_difference=$(($last_commit_unixtime - $last_updated_unixtime))
     local time_difference_abs=$(echo $time_difference | tr -d -)
+    git add ./* > /dev/null
+    if [ -n "$(git diff --cached)" ]; then
+        git commit --allow-empty-message -m ''
+    fi
     # Allow 6 seconds difference since local machine's and GitHub's time may differ slightly.
     if test $time_difference_abs -le 6; then
       echo 'Already up to date.'

This automatically adds files in those folders, and more importantly any edits can be synchronized.
I tested, and dot files don't get automatically added, which is important to me since vim creates '.fname.swp' files.

Sorry, not sure if this is an issue anymore. I meant this to be a question, and then I looked at the code and found the answer... and now I don't know where to suggest this patch. I'm still figuring out github.

@weakish
Copy link
Owner

weakish commented Sep 29, 2015

You can just commit your edits with git. And all the new commits will be synced to gister.github.com in the next run of gister sync. (Provided that time and network on your machine is fine.)

gister will not sync uncommitted edits automatically, because these edits may be working in process.

@isaaclw
Copy link
Contributor Author

isaaclw commented Oct 5, 2015

Huh. Not sure what I was thinking. Yeah, that makes complete sense.

@isaaclw isaaclw closed this as completed Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants