I have a remote device which I access over a wireless and intermittent link. The device logs daily data, and I'd like to be able to get all updates in a robust way. I thought of using git for the purpose:
- I'd have a periodic job which would git commit all the logs on the remote
- At the local server, I'd git pull any new log, so that the underlying protocol would handle the atomicity and robustness of the connection
However, I still have an issue: how do I keep the remote repository "small"? I'd like to purge in some way the revisions which I already got on the local server, but keep the history on the local server.
I tried with git filter branch and repack, but it breaks any clones. I believe it is the same with git rebase --interactive, with the added issue of requiring manual editing of the file (i.e. c开发者_高级运维hanging pick -> squash).
Maybe creating new branches every time and deleting them?
If you are concerned about using up space for the repository on the remote system, then I would suggest not using Git on the remote system at all.
Maybe consider using rsync
to sync between the local and remote systems. For keeping a history on the local system, you can then commit to a Git repository on the local system after each rsync
. This way you have a backup, with complete history, on the local system and no history at all on the remote.
Git is rather overkill, when you could just rotate the log files daily and rsync/scp them away, removing the files you've just copied (apart from the current log file, which might still be being written to).
精彩评论