Skip to content

Find if a branch is merged into another branch. #1150

Open
@Gryzor

Description

@Gryzor

I'm attempting, given a list of local branches (repository.branches(Some(BranchType::Local))), to find out which ones have been merged; basically to know if git branch -d "branch name" would give an error telling you the branch isn't fully merged (and that you must use -D if you want to delete anyway).

(this is "pseudo-code" simplified for this issue, so I'm omitting the match clauses, and whatnot)

I'm calling let br = repository.find_branch(&branch_name, BranchType::Local) and then I'm calling let result = br.delete().

This seems like it doesn't care if the branch is merged or not (perhaps I have this all wrong so I once again ask for forgiveness if what I'm trying to do is the "wrong way").

I've come across this: libgit2/libgit2sharp#1433

But this is C#, and I cannot find what the equivalent would be in the rust bindings (my Rust knowledge is also quite limited).

Apologies for creating an Issue, I wasn't sure where to post this.

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions