Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn before committing to protected branches #141867

Closed
rhalaly opened this issue Jan 31, 2022 · 10 comments
Closed

Warn before committing to protected branches #141867

rhalaly opened this issue Jan 31, 2022 · 10 comments
Assignees
Labels
feature-request Request for new features or functionality git GIT issues
Milestone

Comments

@rhalaly
Copy link

rhalaly commented Jan 31, 2022

It can be helpful to warn before committing to commonly protected branches like main, master, dev, release, etc.
The warning can contain these actions "Create a new branch", "Commit anyway", and "Don't show me again for this repository".

@lszomoru lszomoru added git GIT issues feature-request Request for new features or functionality labels Jan 31, 2022
@rhalaly rhalaly changed the title Warn before commiting to protected branches Warn before committing to protected branches Feb 1, 2022
@jgunnink
Copy link

Related to 62665

I've been burned by this before, and have just been burned by it again now, so I went looking to see if this has been reported before and found this issue.

In today's case it was extremely fortunate that we had good knowledge of the changes, but this has potential to be extremely annoying/catastrophic. Looking at the history it seems that it ignores the protected branch that's on @github and uses some kind of forceful pushing mechanism to write to the main/master/trunk branch. Wondering if this could be changed as a short term fix to not be forceful and then a more eloquent solution, like the suggestion in the issue description or creating an array of protected branches in the settings or something.

@rhalaly
Copy link
Author

rhalaly commented Jun 28, 2022

Adding an array of branches names that should be protected to the workspace settings is a great idea.

Still, I would like to see a message that will allow me to create new branch instantly, skip the warning temporary, or disable the protection for this workspace or globally.

I agree that it should be balanced. It can be very annoying in some cases, like personal small projects that you want to commit the main branch directly, but to be protected when the repository defines protected branches.

@lszomoru
Copy link
Member

The latest Stable release, contains two new settings that enable you to define a set of branch protections, and tweak the behaviour when one attempts to commit to a protected branch. Please take a look and let me know your feedback. This milestone, we are also adding visual indicators into the status bar, and branch picker to indicate branches that are protected.

@lszomoru
Copy link
Member

Closing as duplicate of #148783.

@lszomoru lszomoru modified the milestones: Backlog, May 2022 Jun 28, 2022
@rhalaly
Copy link
Author

rhalaly commented Jun 28, 2022

Thanks @lszomoru ! Any reason why the older request that got enough votes (this one, mine) closed as duplicate of newer feature request that didn't get enough votes yet?

Why it was implement due to the new one and not this one?

I'm asking to understand if something is wrong with my request

@lszomoru
Copy link
Member

lszomoru commented Jul 1, 2022

@rhalaly, there was nothing wrong with the feature request that you have filed. Even though I labeled the issue when it was filed in January, I simply forgot about it when #148783 was created so I have used that to track the implementation. I only remembered about this issue couple of days ago when a new comment was posted to it. Hope that answers your concerns.

@rhalaly
Copy link
Author

rhalaly commented Jul 1, 2022

Thanks @lszomoru!

@github-actions github-actions bot locked and limited conversation to collaborators Aug 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality git GIT issues
Projects
None yet
Development

No branches or pull requests

4 participants
@lszomoru @jgunnink @rhalaly and others