docs: discourage setting push options forever #7

merged
opened by a.starrysky.fyi targeting main from private/minion/push-mpovsvomkqon

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...

Changed files
+14 -9
+14 -9
README.md
··· 59 59 git push origin HEAD:my-new-branch -o base=main 60 60 ``` 61 61 62 - If you want to always pick `main` by default you can set this in your 63 - repository-specific *git* config 64 - 65 - ```bash 66 - git config push.pushOption 'base=main' 62 + If you're using a git frontend (e.g. [Jujutsu](https://jj-vcs.github.io/jj)) 63 + which does not allow you to set push options, you may find it useful to 64 + temporarily set them through the git configuration while performing git 65 + operations. In Jujutsu, you might do that through these aliases: 66 + 67 + ```toml 68 + [aliases] 69 + josh-push-base-main = [ 'util', 'exec', '--', 'sh', '-c', 'git config push.pushOption base=main && jj git push "$@"; git config --unset push.pushOption', '--' ] 70 + josh-push-create = [ 'util', 'exec', '--', 'sh', '-c', 'git config push.pushOption create && jj git push "$@"; git config --unset push.pushOption', '--' ] 71 + josh-push-force = [ 'util', 'exec', '--', 'sh', '-c', 'git config push.pushOption force && jj git push "$@"; git config --unset push.pushOption', '--' ] 72 + josh-push-merge = [ 'util', 'exec', '--', 'sh', '-c', 'git config push.pushOption merge && jj git push "$@"; git config --unset push.pushOption', '--' ] 67 73 ``` 68 74 69 - Setting this in your *git* config may also be useful if 70 - you're using an alternative *git* frontend, for example 71 - [*Jujutsu*](https://jj-vcs.github.io/jj/latest/), which does not provide the 72 - ability to set push-options when pushing to git remotes 75 + You must make sure you always unset the push option, even if your push failed. 76 + Pushing with unexpected push options can cause accidental and annoying-to-fix 77 + actions to be taken on your behalf 73 78 74 79 ### Signing commits 75 80