Created
March 22, 2018 19:30
-
-
Save MathyV/80d2507f6843e391211f2ec5e0effa3c to your computer and use it in GitHub Desktop.
Force push with pygit2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I had a need to force update and push the master branch | |
# Took me a while to find this so I thought I'd share | |
# Just add a + in front of the branch name and it will work | |
branch = "refs/heads/master" | |
repo.create_reference(branch, "refs/heads/develop", force=True) | |
repo.remotes['origin'].push(['+' + branch], callbacks=callbacks); |
great code, but can you please help to share whether there will be a new remote branch?
Not sure what you are getting at @homeday but if you force push it will overwrite the existing remote branch or create a new one if it doesn´t exist yet.
ok, got it. Thank you.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great code, but can you please help to share whether there will be a new remote branch?