Reputation: 610
I often do the same mistake, I do some corrections (or modifications) on my code, forgot to create a new branch for it and push it directly on the develop branch of my Gitlab repo.
Is there a way, in VS Code, to be warmed before pushing changes to a selected branch of the distant repo ?
Upvotes: 1
Views: 1471
Reputation: 610
Since May 2022 (version 1.68), it is now possible to use git.branchProtection
and git.branchProtectionPrompt
to protect, directly from VS Code, some Git branches.
That's exactly what I was looking for.
See this link (at the time of writing, I can't find any documentation).
Upvotes: 1
Reputation: 36780
You could also protect the branch by making it protected and only allow pull requests in GitLab:
Require everyone to submit merge requests for a protected branch
You can force everyone to submit a merge request, rather than allowing them to check in directly to a protected branch. This setting is compatible with workflows like the GitLab workflow.
The push will be rejected, just like the pre-push hook.
Upvotes: 2