Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
197 views
in Technique[技术] by (71.8m points)

c - Rebase using libgit2

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
", rc);

    printf("%d
", 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

question from:https://stackoverflow.com/questions/65887614/rebase-using-libgit2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...