From 843f922e5a0f9788a400c88418674226743f6ba8 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Wed, 17 Sep 2025 01:42:48 +0000 Subject: [PATCH] docs: discourage setting push options forever Change-Id: mpovsvomkqonorzmyzponvrxvktxnuqm We've seen some weird consequences which appear to be from setting the base=main push option all the time - it's better to use some aliases or something to set the options only when needed... --- README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d78604b..c3b5060 100644 --- a/README.md +++ b/README.md @@ -59,17 +59,22 @@ You can tell *josh* by providing the `base=` push option like so: git push origin HEAD:my-new-branch -o base=main ``` -If you want to always pick `main` by default you can set this in your -repository-specific *git* config - -```bash -git config push.pushOption 'base=main' +If you're using a git frontend (e.g. [Jujutsu](https://jj-vcs.github.io/jj)) +which does not allow you to set push options, you may find it useful to +temporarily set them through the git configuration while performing git +operations. In Jujutsu, you might do that through these aliases: + +```toml +[aliases] +josh-push-base-main = [ 'util', 'exec', '--', 'sh', '-c', 'git config push.pushOption base=main && jj git push "$@"; git config --unset push.pushOption', '--' ] +josh-push-create = [ 'util', 'exec', '--', 'sh', '-c', 'git config push.pushOption create && jj git push "$@"; git config --unset push.pushOption', '--' ] +josh-push-force = [ 'util', 'exec', '--', 'sh', '-c', 'git config push.pushOption force && jj git push "$@"; git config --unset push.pushOption', '--' ] +josh-push-merge = [ 'util', 'exec', '--', 'sh', '-c', 'git config push.pushOption merge && jj git push "$@"; git config --unset push.pushOption', '--' ] ``` -Setting this in your *git* config may also be useful if -you're using an alternative *git* frontend, for example -[*Jujutsu*](https://jj-vcs.github.io/jj/latest/), which does not provide the -ability to set push-options when pushing to git remotes +You must make sure you always unset the push option, even if your push failed. +Pushing with unexpected push options can cause accidental and annoying-to-fix +actions to be taken on your behalf ### Signing commits -- 2.43.0