From 311e0351b555c9015a98c391a3ca7861c4fb6c35 Mon Sep 17 00:00:00 2001 From: Pierre Thierry Date: Tue, 26 Dec 2023 11:28:26 +0100 Subject: [PATCH] Make force-with-lease the default (#31) --- CHANGELOG.md | 6 ++++++ lib/cli.ml | 2 +- lib/git.ml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25902ab..8acb9c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ available [on GitHub][2]. +### Changed +- [#31](https://github.com/chshersh/zbg/pull/31): + Command `zbg push -f` now uses git's `--force-with-lease` because it's a safer default + (by [@kephas]) + ## [0.2.0] — 2023-12-17 🎄 ### Added @@ -44,6 +49,7 @@ Initial release prepared by [@chshersh]. [@paulpatault]: https://github.com/paulpatault [@sloboegen]: https://github.com/sloboegen [@tekknoid]: https://github.com/tekknoid +[@kephas]: https://github.com/kephas diff --git a/lib/cli.ml b/lib/cli.ml index e856842..e8c15c4 100644 --- a/lib/cli.ml +++ b/lib/cli.ml @@ -45,7 +45,7 @@ let cmd_new = let cmd_push = Command.basic ~summary:"Push the current branch to origin" (let%map_open.Command force = - flag "f" ~aliases:[ "--force" ] no_arg + flag "f" ~aliases:[ "--force-with-lease" ] no_arg ~doc:"Push forcefully and override changes" in fun () -> Git.push (to_force_flag force)) diff --git a/lib/git.ml b/lib/git.ml index 45f6c33..f753c35 100644 --- a/lib/git.ml +++ b/lib/git.ml @@ -110,7 +110,7 @@ let push force = let flag_option = match force with | NoForce -> "" - | Force -> "--force" + | Force -> "--force-with-lease" in Process.proc @@ Printf.sprintf "git push --set-upstream origin %s %s" current_branch