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

Investigate if there is a way to prevent push to main when using gps #274

Open
drewdeponte opened this issue Nov 13, 2023 · 1 comment
Open

Comments

@drewdeponte
Copy link
Owner

The idea is to see if there is a way to prevent a push to main when using gps. Or maybe configure branches with .git/config in such a way where it is safer if a git push happens.

Maybe having where a push happens could be different from where a pull happens with a branch configuration in .git/config? Or maybe there is some other option in the .git/config I am not aware of that would aid with this.

https://git-scm.com/docs/git-config

@trcoffman
Copy link

I've figured out that the best way to prevent accidentally pushing your patchstack to remote (especially important when your patchstack is main) is to configure the branch's pushRemote to be a different remote.

For instance, you can have a fork remote of your repository and do something like git config branch.main.pushRemote fork.

Your patchstack's upstream branch can still be origin/main or something like that, but it'll push to fork/main instead. GPS will still work as you expect and create PRs for you targeting origin/main.

Another thing that I did is to rename origin to upstream in case some tooling doesn't respect config and just pushes to origin without looking at config. This will prevent those primitive tools from working and pushing when you don't want them to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants