Crate: how to publish a fork

I'm looking for the best practice about publishing on a fork of an existing crate but which isn't actively patched.

What I did from now:

  • Fork on GitHub
  • Did a new branch and sent my work as a Pull Request

Now, I'm looking in case of the PR won't be merged in few days/weeks, how can I publish my fork?

Do I need to change the name or is it possible to keep the same name?
If I change the name in Cargo.toml, it's like doing a hard fork, and it's strange to don't have "username/crate's name" has an alternative to push on

Do you have best practices or return of experience about this situation?


Some of my personal practices:

  1. Don't publish the fork unless you must. If you need to publish something that depends on the fork, then you have to publish the fork too. But if you are using it from code that is not released to, you can often get away with using a git dependency or an override.

  2. You do have to change the package name. If the fork is just temporary or for your personal use, change the package name to use your username or organization name as a prefix (for example, I might publish a personal fork of serde called mbrubeck-serde). If it's a long-lived fork that other people might use, you might want to use a more descriptive name.

    Users of the fork can rename the dependency in Cargo.toml, so their code can still refer to the original library name:

    serde = { version = "1.0", package = "mbrubeck-serde" }
  3. Update the README file to explain what you forked and why, and add a link to the original crate.

  4. When your fork is no longer needed (because your changes have been merged into the original crate), consider yanking all versions of your fork, so they won't show up in search results.


Thank you a lot from a newcomer to Rust and I approve about publishing if it's really needed.

In my case, this is my PR, and I'll use the git way for my current project but if it's not merged, effectively, I'll publish with a good name because it's interesting to have more choice about compression for this library (avro-rs).

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.