Why does the "Limit how many branches and tags can be updated in a single push" setting have any option other than 1? #30557
-
My instinct says this setting should always be 1, yet 1 isn't even an option. I don't recall a time I've ever intentionally pushed to more than one branch or tag at a time, so why would anyone ever want it to be more than one, let alone be unable to even set it to this seemingly unintuitive value? Am I not understanding what this setting is actually doing? Or am I not understanding what git pushing is actually doing? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
I think you understand the setting correctly. I agree pushing a single branch or tag (ref) is the most common case, but pushing multiple refs is possible and sometimes desired, for example when mirroring a repository, or if you want to push a new release commit to a branch along with a tag. I assume the setting is inspired by that: Some people might not be aware of that possibility, or mistype, and then get undesirable results (especially if force-push is allowed). |
Beta Was this translation helpful? Give feedback.
-
"We recommend the default maximum of 5 branch or tag updates allowed in one push. The minimum value is 2 since two branch updates are required by Git to rename a branch in a single push: delete branch and create branch. Lower numbers are more restrictive of which pushes are allowed, and higher numbers are less restrictive but have more potential for being destructive. As part of this feature's beta, we'd like to learn which number works best for you" |
Beta Was this translation helpful? Give feedback.
-
Can the error message for 1 be updated to give the explanation from the page:
Or maybe a direct link to this discussion which is probably canonical about the topic (the topic could be shortened to "why one/1 isn't valid for 'Limit how many branches and tags can be updated in a single push' option." which is an more correct (as I think there are other options that maybe rejected than 1, like non numbers, etc.) and the option is also meant to have > 1, not to preclude more than 1. But thanks for the explanation, the option and the discussion! |
Beta Was this translation helpful? Give feedback.
-
TBH I would strongly prefer to limit it to 1 and say "you can't rename a branch. make the new one and delete the old one, as two separate actions". That's easy, and also prevents changing a branch name by accident. Tag-wise specifically, pushing even two tags at once is almost always going to be a mistake for things I've worked on, and being able to prevent that mistake would be great. External systems often watch tags (regrettably), and sometimes must be handled with extreme care. |
Beta Was this translation helpful? Give feedback.
"We recommend the default maximum of 5 branch or tag updates allowed in one push. The minimum value is 2 since two branch updates are required by Git to rename a branch in a single push: delete branch and create branch. Lower numbers are more restrictive of which pushes are allowed, and higher numbers are less restrictive but have more potential for being destructive. As part of this feature's beta, we'd like to learn which number works best for you"
https://github.blog/changelog/2022-06-15-block-potentially-destructive-git-pushes/#:~:text=We%20recommend%20the%20default%20maximum,delete%20branch%20and%20create%20branch.