rust-lang / rust-lang/git2-rs

How to `git rebase --root` ?

Open
#800 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.1k
Forks
450
Avg merge
11m
Merged PRs (30d)
1

Description

Hello, I a trying to implement an interactive rebase to modify all commit in a repository, including the first one.
The git cli provides the --root option to do so but I am having trouble translating this to git2-rs.
Reading at libgit2 doc I am still not sure what argument is expected to perform a "root" rebase ?

repository.rebase(
  Some(&head), // Current branch
  None, // No upstream to get all reachable commits
  Some(&onto), // needs to be provided or we get the following error : "Error: invalid argument: 'upstream || onto'; class=Invalid (3)
" 
  None // No opt ? 
)?;

Doing so on a repository containing only the first commit, I am not able to reach it.
Any hint ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the repository.rebase entry point and the libgit2 git_rebase_init documentation linked in the issue, then inspect how upstream, onto, and options are represented by git2-rs. Reproduce the case with a repository containing only its first commit and document or test the valid behavior for an interactive root rebase.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.