I have not been very familiar with Git until now (I have been using Mercurial mostly). Planning to publish several Rust crates soon (and not wanting to use crates.io for a couple of reasons), I decided to use Git in future to manage the source code of my Rust projects, because apparently Cargo's support for other version control systems is limited (I can't specify non-local dependencies without using Git or a registry).
Apart from the need caused by Cargo, moving to Git might come with a few other benefits too.
Anyway, while figuring out a publication workflow that works well for me, I wondered what's the best way to ensure that commits (or merges) to a certain branch are always
rustfmt'ed? Are there some good examples how do achieve that? Since Git will commit what's staged in the index (and not what's in the working directory), I guess simply running
cargo fmt prior to committing isn't working. Is there somewhere a good collection of Git hooks that make working with Cargo easier?