Can someone please explain how this is possible that "git log -1" returns different hash on the same repository on different machines (repositories are fully synced)?
- we have several docker containers that run cron jobs and periodically pull the repository (the containers don't push anything - just get latest)
- each of them runs this command on startup:
git clone --filter=blob:none --no-checkout --single-branch --branch master --depth 1 git@github.com:<our repository>.git /<destination-folder>/
git sparse-checkout set /<repository-sub-folder>
git checkout
- there's a cron job that runs the following command every few minutes (only one container at a time):
git pull --ff-only
cd <repository-sub-folder>
git log -1 -- .
The problem is that it becomes out of sync at some point and "git log" returns different commit ID when running from two different containers. Note that the state of remote repository is the same at this point and all containers pulled latest version from remote.
After I remove the local copy of repository and run initial script again (which clones remote repo in sparse mode) the issue doesn't happen.