← Back to context

Comment by andix

4 years ago

What I always wanted to have is a tool that syncs my uncommitted changes of git repos between all my devices. So that I can switch from the desktop to the laptop without committing, pushing and pulling. Right where I stopped. Also sync not yet pushed commits, I may want to rebase/edit before pushing.

This was exactly my use case for building gut, https://github.com/tillberg/gut. It's a daemon that wraps git, auto-committing changes for a tree and bidirectionally syncing them between N computers. The wrapped git is autorenamed from git to gut so that it can commit git folders. The gut tools are usable for exploring/manipulating history of this meta-repo, too. I saved myself from disaster a couple times with `gut checkout ...`.

Nowadays I use Syncthing for the same purpose (I learned about Syncthing when I did a Show HN for gut). Dropbox works reasonably well, too.

> What I always wanted to have is a tool that syncs my uncommitted changes of git repos between all my devices.

can't git do this with a fork, and you put all your devices on the fork, then merge the fork when you're ready?

  • Sure, but then I would need to fork all repos I work on. Also you still would need to commit and push it somewhere.

    It’s possible, but it’s some steps you need to take. You can’t just get up from your pc, take your laptop and start working.

    Local changes in gut feel like in the pre-Dropbox era, something you need to copy on your own.

By uncommitted changes do you mean edited files? Then something like syncthing or anything functionally similar to Dropbox.

100x yes. I agree with parent that pushing live changes is way to intrusive, but a synced working/staging directory could be incredibly helpful.

I don’t see any fundamental reason why git or, even 3p tooling for git, couldn’t support this use case using something like private, ephemeral, auto-synced branches.

Here's the roundabout way I sync uncommitted changes. Push everything to a new tmp branch. Then on the other system, fetch and cherry-pick the last commit id, then reset HEAD~1. Boom uncommitted changes synced.