How to git autocommit on file save?

1,059 views
Skip to first unread message

Daniel Johnson

unread,
Aug 18, 2013, 5:28:46 AM8/18/13
to pdx...@googlegroups.com
I seem to remember someone getting git to commit on every file save.
After firefox failed to restore a window full of tabs I want to set
this up for sessionstore.js so this doesn't completely derail my
productivity when it happens again.

--
teknotus (Take Notice)

benh

unread,
Aug 19, 2013, 10:14:21 AM8/19/13
to pdx...@googlegroups.com
Seems like a task for guard: https://rubygems.org/gems/guard
> --
> You received this message because you are subscribed to the Google Groups "pdxgit" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pdxgit+un...@googlegroups.com.
> Visit this group at http://groups.google.com/group/pdxgit.
> For more options, visit https://groups.google.com/groups/opt_out.



--
benh~

http://about.notbenh.info

Stability is not a Regression.

Jacob A. Helwig

unread,
Aug 19, 2013, 11:02:16 AM8/19/13
to pdx...@googlegroups.com
I think you might be remembering something I mentioned at PDX DevOps quite some time ago, and I was using the Ruby gem that Ben mentioned (guard) to handle it. I can try to dig up the Guardfile in question if you'd like, once I'm near my personal laptop.

-Jacob

--
http://technosorcery.net/about/me

benh

unread,
Aug 19, 2013, 12:22:38 PM8/19/13
to pdx...@googlegroups.com
Yaa! I did a Dev-Opsy-Thing-good =)

Jonathan "Duke" Leto

unread,
Aug 19, 2013, 12:28:51 PM8/19/13
to pdx...@googlegroups.com
Howdy,

On Linux, my recommendation is to use inotify and do a "git commit" when the modification time of the file changes.

Duke


On Sun, Aug 18, 2013 at 2:28 AM, Daniel Johnson <tekn...@gmail.com> wrote:

--
teknotus (Take Notice)

--
You received this message because you are subscribed to the Google Groups "pdxgit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdxgit+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/pdxgit.
For more options, visit https://groups.google.com/groups/opt_out.



--
Jonathan "Duke" Leto <du...@leto.net>
Leto Labs LLC http://letolabs.com
209.691.DUKE http://duke.leto.net
@dukeleto LinkedIn Github

Chuck Vose

unread,
Aug 19, 2013, 11:42:09 AM8/19/13
to pdx...@googlegroups.com
Daniel,

Just do your team a favor and commit to a branch and then interactive-rebase-squash them into a few commits at the end. Some teams, mine included, have a contract that every commit should be in a runnable/semi-correct state so that git-bisect works correctly but committing each save would guarantee that this contract would not work. 

In addition, how would you name the commits to be meaningful?

Have you considered using dropbox instead? We use Dropbox for those bad days when things just don't work, and we do try to commit about once an hour or so when we finish major milestones in a feature, but this means that the commits that we do make are really meaningful and historically important. Then to keep to the contract we squash them at the end into one commit. Our team is a little weird though and people much smarter than us don't do this; I know twitter doesn't squish commits for instance. 

Thanks for bringing it up though! I think this is a fascinating topic and I'd love to hear where you go with it and what works for you!

-Chuck


On Sun, Aug 18, 2013 at 2:28 AM, Daniel Johnson <tekn...@gmail.com> wrote:

--
teknotus (Take Notice)

Jonathan "Duke" Leto

unread,
Aug 19, 2013, 12:36:24 PM8/19/13
to pdx...@googlegroups.com
Howdy,

There is a bit of a moral high-ground in your workflow recommendation. Recommending somebody rebase/squash every time when they want the simplest possible thing seems like a non-starter.

Situations exist where the solution Teknotus seeks is a good solution. Such as the case of an individual working on extremely fast-changing code/data that doesn't need to be shared with anybody. Or when you plan on doing a night of drunken coding and you just squash the entire history when sobriety comes back.

As for meaningful commit messages, they can be generated, such as "14 lines modified in foo.txt", which is better than most commit messages humans write :)

Duke

benh

unread,
Aug 19, 2013, 12:58:06 PM8/19/13
to pdx...@googlegroups.com
I guess the larger question is, for a browser profile, how often is
that something that is committed to a project for sharing? Rather then
using git as a way to log history and allow for reverts to the past?
Reply all
Reply to author
Forward
0 new messages