Is there an option in TFS to make developers get latest changes before they commit?
I have a few developers who are reluctant to update (and check that their changes actually work with the current version), and just commit. Very often breaking the build this way.
We have a CI build every 15 minutes, but this is also about developers using other developer's changes early.
Note: We are considering switching to git just over this issue.
You could configure your build to be a true CI build, though it will not prevent people from checking in before getting latest. It should detect who broke which build. Some people will even configure a Gated build to not even check in without a passing build. I personally dislike this, as it slows down integration, often considerably.
To catch the case you want to catch, you could implement a Custom Checkin Policy, register it with TFS and install it to all the Visual Studio and Team Explorer Everywhere installations in your organisation. Creating a policy is pretty straightforward:
And you'll have to build both, since the configuration of checkin policies happens through Visual Studio and requires the C# implementation. BAsically you'd query the local workspace version and compare that against latest workspace version on the server. Optionally scoped to only the files changed. Your developer should then get-latest, rebuild, rerun all unit tests and try to check in again. This may cause another collision.
I've written more guidance on this topic in a very similar previous question. I suspect your problem is worse than a simple check in the tools, it's a people thing where people may not really care about what others are doing and where they're not communicating enough to pre-empt these kinds of conflicts.
See also: Avoid accidental overwrite between different developers upon checkin or merge