gitdoc icon indicating copy to clipboard operation
gitdoc copied to clipboard

Gitdoc overwrote changes

Open tyrel opened this issue 4 years ago • 6 comments

I have a notes repository I'm syncing using Gitdoc. Last night I was on another computer and made a bunch of changes to some notes and committed and pushed. This morning when I got back to my first computer, I took some notes in another file, saved, and it synced. Then I noticed that the notes I took last night are gone. If I look at the git reflog, there are no commits from last night. Did Gitdoc do a force push and erase my changes? Is it possible to prevent it from force-pushing?

tyrel avatar Apr 21 '21 15:04 tyrel

Hmm, yeah it does a force push, which is strictly to enable you to undo/revert changes via the Timeline view. But this issue is a good reason of why that could be too restrictive. So I could probably disable that behavior by default.

That said, I wonder if it also makes sense to do auto-pulls on some kind of frequency by default, to better support the multi-machine case. Right now, GitDoc only auto-pulls on push by default, but that is potentially problematic, for the reason you mentioned.

lostintangent avatar Apr 21 '21 20:04 lostintangent

What if it were to do a pull before commit? Then it would have got my other changes and created a new commit on top of them, instead of creating a new commit tree. Along the same lines, though, if it pulls before it pushes, which is on by default, wouldn't it have got my commits and rebased its new work on top of the old work, so it didn't get lost?

tyrel avatar Apr 23 '21 02:04 tyrel

Right now, it pulls after a push. And so yeah, another solution could be to pull before the push. I'll play around with it tomorrow and try to get a new release out ASAP. Sorry again for the inconvenience here!

lostintangent avatar Apr 23 '21 03:04 lostintangent

Oh yeah, that would be a good change. Pulling after pushing would have no effect, 99.9% of the time, unless someone else happened to push in the milliseconds between your push and pull.

tyrel avatar Apr 23 '21 03:04 tyrel

Is this fixed, already?

theAkito avatar Nov 01 '22 15:11 theAkito