Created
October 14, 2016 16:35
-
-
Save severin-lemaignan/f8d783514376152d70f29b32e2375970 to your computer and use it in GitHub Desktop.
Rebase with pygit2
This file contains hidden or 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
# Purpose: rebase 'other' on top of 'master' | |
branchc = repo.lookup_branch("other") | |
branchb = repo.lookup_branch("master") | |
base = repo.merge_base(branchb.target, branchc.target) | |
treeb=repo.get(branchb.target).tree | |
treec=repo.get(branchc.target).tree | |
base_tree = repo.get(base).tree | |
repo.checkout(branchb) | |
index=repo.merge_trees(base_tree,treeb,treec) | |
tree_id = index.write_tree(repo) | |
repo.create_commit(branchc.name, sig, sig, "blah", tree_id, [branchb.target]) | |
#--------------------------------------------------------------------------- | |
#GitError Traceback (most recent call last) | |
#<ipython-input-33-f3577ddcf5b0> in <module>() | |
#----> 1 repo.create_commit(branchc.name, sig, sig, "blah", tree_id, [branchb.target]) | |
# | |
#GitError: failed to create commit: current tip is not the first parent |
since its already committed so its not the parent give the parent if you already committed else leave it blank
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it work