You should not use --force
, if you cannot afford losing the other commits and subsequently the other files!
Instead use a pull to pull in the changes of the other processes and push afterwards:
git pull origin master && git push origin master
In case you want to have your repository clean of merge commits consider using pull --rebase
:
git pull --rebase origin master && git push origin master
Note that there is a slight window between the pull
and the push
where again commits could slip in, consider repeating the command as necessary if it does not go through. But keep in mind that this could cause a hang.