Skip to content

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

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

Open
Gryzor opened this issue Mar 26, 2025 · 0 comments
Open

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

Gryzor opened this issue Mar 26, 2025 · 0 comments

Comments

@Gryzor
Copy link

Gryzor commented Mar 26, 2025

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.

@Gryzor Gryzor changed the title Find if a branch is merged to another branch. Find if a branch is merged into another branch. Mar 26, 2025
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