tags:

views:

729

answers:

2

I have an old branch, which I would like to delete. However, before doing so, I want to check that all commits made to this branch were at some point merged into some other branch. Thus, I'd like to see all commits made to my current branch which have not been applied to any other branch [or, if this is not possible without some scripting, how does one see all commits in one branch which have not been applied to another given branch?].

Many thanks!

+11  A: 

You probably just want

git branch --contains branch-to-delete

If it reports something, the branch has been merged.

Your alternatives are really just rev-list syntax things. e.g. git log one-branch..another-branch shows everything that one-branch needs to have everything another-branch has.

You may also be interested in git show-branch as a way to see what's where.

Dustin
+1. See also http://stackoverflow.com/questions/850607/difference-in-git-log-origin-master-vs-git-log-origin-master
VonC
Thanks, "git branch --contains ..." is exactly what I wanted
+3  A: 

If it is one (single) branch that you need to check, for example if you want that branch 'B' is fully merged into branch 'A', you can simply do the following:

$ git checkout A
$ git branch -d B

git branch -d <branchname> has the safety that "The branch must be fully merged in HEAD."

Jakub Narębski