I have encountered the dependency hell in Polkadot Rust, that is when I was trying to build a Parachain(https://github.com/substrate-developer-hub/substrate-parachain-template) with Frontier, I was trying to make sure both the Parachain and Frontier were based on the same version of substrate (https://github.com/paritytech/substrate), but Frontier repository did not have a version that is based on substrate polkadot-v0.9.17.
checkout a branch polkadot-v0.9.17 in Frontier
in above Frontier branch, replace all substrate dependencies with branch = "polkadot-v0.9.17"
then delete the template folder or if you want to fix the code in it