diff --git a/src/ops/git.rs b/src/ops/git.rs index e680c22b0..2d0eee372 100644 --- a/src/ops/git.rs +++ b/src/ops/git.rs @@ -203,7 +203,9 @@ pub fn push<'s>( options: impl IntoIterator, dry_run: bool, ) -> CargoResult { - let mut command = vec!["git", "push"]; + // Use an atomic push to ensure that e.g. if main and a tag are pushed together, and the local + // main diverges from the remote main, that the push fails entirely. + let mut command = vec!["git", "push", "--atomic"]; for option in options { command.push("--push-option");