Okay, I have a desktop and a laptop. I don't think that's surprising.

I do sync the contents of both via git. Also not surprising.

But I thought, hmm, I hate having to do temporary git commits. Stuff like

git add .
git commit -m temp
git push

Just so I can remove it alter via

git reset HEAD^

I hate it because it forces me to force push. So, how do I sync stuff I do not want to commit yet?

Well, I just set up an instance of owncloud. Was easy. 20 minutes and everything is running. Can recommend. But...

For some reason it doesn't work. It syncs stuff just fine... But it also syncs my .git directory... I thought it wouldn't be a problem.

Saves me a pull. Don't have to pull what's synced, right? Also setting up new projects should be terribly simple. Just add it normally. So, git just versions and does pipelines. And I copy everything inside the git directory over.

Also allows me to have more private .git/info/exclude files and hooks...

But for some reason... everything is synced. Dot-files are being synced as well. Everything works... But running git status on one side tells me everything is commited... Doing it on the other side it tells me there are new files.

How is that possible??? I kind of expected that even a branch checkout would be synced... Was curious if that would lead to issues, but I didn't expect it just not recognizing changes. Git doesn't hold projects in memory, does it? Nah, that doesn't make any sense. So, why does git status disagree? Git log is identical... Git status is not...

It makes no bloody sense.

  • 1
    One thing that comes to mind are line endings, maybe git on your laptop is configured to commit all line endings as "\n", while git on your desktop is configured to commit them "as is"?
  • 0

    Good point. But it is not that. To avoid line ending trouble I have installed it in WSL on my laptop and have it natively on Linux on my Desktop.
  • 1
    I should have git diffed them...

    old mode 100755

    new mode 100644

    That explains it... Wonder if I can do something about it... Can I sync file modes?

    Guess someone has to google and this someone is me...
  • 1
    What is wrong with syncing with, you know, rsync?
  • 4
    To be fair, i think it's just easier to use a WIP branch, do as many commit as you wish and cleanup you work with a rebate squash when you want to merge. Remember you can even have branches in several remote repositories, even private, and pull updates straight from your other device (if it's online).
  • 2
    As far as I know all the information is stored in the .git file

    I've got a repo in my Dropbox, and I have Dropbox sync to a folder on my Windows PC and my Mac.

    If I make a change on my Mac without commit and open the repo folder on my Windows machine I can see the same change and I see in Dropbox that the .git file has changed

    There really shouldn't be anything more complex to it.

    What you should do to test it out is create a new simple repo, change a file on one machine, and see if it ends up as expected on the other.

    If they works then probably you have some odd config, file type or other thing in your problematic repo.
  • 0
    I just learned owncloud is definitely not suited to have any form of often written files synced.

    It just renamed a file as a copy because it was already there in a different version. No way of changing this behaviour... Too bad... Guess I will try seafile soon.
  • 0

    A WIP branch would have the exact same issue. And I do not clean my branch up afterwards. I do commit small units that are logically connected. That means, I often split a single file full with changes into multiple commits. As one is supposed to do...

    Cleaning that up afterwards is hell of a lot of work.

    But the idea is actually simple. I just want to take my laptop and keep working. Seemlessly. And it was an experiement.
  • 3
  • 1

    Just finished setting up syncthing.

    And woah, it's great.

    I have now a three way sync. Desktop to server to laptop. It keeps file mode changes. Just as I want it. Git behaves like expected (so far).

    With it's web interface I can perfectly run it in docker on all systems. That's amazing. Just out of spite I copied the docker-compose.yml to my lappy using owncloud. Set up your replacement, owncloud... Nah, not really. I keep owncloud for files. Just setting up backups and then bye bye for gdrive.

    Anyway, syncthing, super easy to set up. Half an hour effort for the dockerized version including putting it's web interface behind nginx.

    It seems like the perfect recommendation for my use case. Thank you!
  • 1
    @TheCommoner282 glad it worked, have a nice day.
Add Comment