navderm
navderm

Reputation: 819

"git branch -d" doesn't delete branch

I merged a branch in master a few days ago. I didn't make any changes in the branch, but when I tried to delete it today with git branch -d branch_name it said the branch isn't fully merged in.

I got curious and did a gitg and saw that there was a stash in the branch. So I thought may be that stash is causing that behavior. I deleted the stash. But still I get the same error.

Doing a git status doesn't show any changes.

I can delete the branch using git branch -D branch_name.

  1. Why isn't -d working?
  2. How can I see what is not merged in? (gitg doesn't show anything.)

Upvotes: 1

Views: 486

Answers (1)

Schleis
Schleis

Reputation: 43700

It means that you have commits on the branch that you are trying to delete that are not in the branch that you are currently one.

git diff <branch you are one> <branch you are deleting>

should show what is not merged in (in diff format).

As this answer says doing git branch --contains branch-to-delete should show the commits that are not merged.

Upvotes: 2

Related Questions