Syncing files from two potentially offline sources is a hard problem that is basically impossible to solve in a way that makes sense all the time. For evidence of this, look no further than the complexity of the tools programmers use to solve this problem for source files rather than game saves:
To be clear, I'm not suggesting you use one of these! Just illustrating the
widespread and unsolved nature of the problem.
The problem, as you touched on, is not so much in syncing the files as much as determining what to do when a file changes in two different ways. One option, as you mentioned, is to simply choose one version of the file over the other. It's very difficult to choose exactly which one, though!
You can also attempt to merge the files, as the aforementioned source control tools do. In doing so, you look at both the files, determined what's changed, and attempt to create a new file that contains both sets of changes!
Inevitably, this has cases that source control tools call merge conflicts - when two files have mutually incompatible edits compared to their previous version and the correct resolution cannot be determined by the software. UI to resolve merge conflicts is nasty and unintuitive and you'd be better off just asking the player which save file is the right one.
Depending on your game, though, you might be able to cheat. If your game doesn't have any incompatible decisions (ex: branching storyline), you can just keep the best value available. Let me dive into this a little more...
Let's say the save file online has one star each on levels 1, 2, and 3.
The user plays the game on their tablet (offline) and earns three stars on level 1.
The user plays the game on their phone (offline) and earns three starts on level 2.
The user suddenly gets an internet connection on their phone and the game automatically saves to the cloud.
The user then connects to Wi-Fi on their tablet and loads the game - the game recognizes what happened and shows 3 stars on both levels.
If the game does have cases of mutually incompatible decisions, it may be preferable just to support multiple save files and, in case of a merge conflict, keep the newer one (by local time) and save the older one to the list as a backup.