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

Question/Feature request: Rebase branch using a Tag as upstream #2056

Open
george-pancescu opened this issue Aug 29, 2023 · 0 comments
Open

Comments

@george-pancescu
Copy link

george-pancescu commented Aug 29, 2023

This is potentially a feature request, if there is no way of accomplishing this using the current version of LibGit2Sharp

I am trying to use LibGit2Sharp to rebase a feature branch using a Tag as upstream. The initial graph looks like this:

          * -- * -- * (featureA)
         /          
        /
 *--*--*--*--*--*--*--*--*--*--*--*-- (master)
       |        |        |        |    
       tag1    tag2     tag3    tag4    

The idea is to rebase featureA branch on master, but not on the HEAD of master (last commit), but rather on the commit corresponding to tag2.

The end result would be something like this:

                   * -- * -- * (featureA)
                  /          
                 /
 *--*--*--*--*--*--*--*--*--*--*--*-- (master)
       |        |        |        |    
       tag1    tag2     tag3    tag4 

The git syntax for this would be (and it works perfectly):

git rebase ref/tags/tag2 featureA

However, LibGit2Sharp syntax only allows passing in a Branch as argument for the upstream param.

var rebaseOptions = new RebaseOptions {...};
var identity = new Identity(...);

Branch branch = repo.Head;
Tag upstreamTag = repo.Tags[ontoTag]; 

var rebaseResult = repo.Rebase.Start(
    branch, 
    upstream, // <-- this is where I am struggling to pass in this Tag as upstream
    null, 
    identity, 
    rebaseOptions);

Is this achievable via LibGit2Sharp?

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

1 participant