Rebase using libgit2

Viewed 127

enter image description here

int rebase(const char *onto_str)
{
    git_rebase_options opts = GIT_REBASE_OPTIONS_INIT;

    git_repository_head(&head, repo);
    git_annotated_commit_from_ref(&branch, repo, head);
    git_branch_lookup(&ref, repo, onto_str, GIT_BRANCH_LOCAL);
    git_annotated_commit_from_ref(&onto, repo, ref);

    git_rebase_init(&rebase, repo, branch, 0, onto, &opts);

    while ((rc = git_rebase_next(&op, rebase)) == 0)
        printf("%d\n", rc);

    printf("%d\n", rc);
}

While on branch "new" I do rebase master and get output

0
-13

Reference "new" now 7fe5cbd and working dir contain changes from 70d5af. What's wrong? Branch "new" only change one file and "master" change another

1 Answers

Ahhh, I need to git_rebase_commit() each step in while!

Related