Tim
Tim

Reputation: 99398

How can I check whether a branch has been merged into another branch?

In command line, how can I check whether a branch has been merged into another branch, and if yes, find out which branch it has been merged into?

Upvotes: 14

Views: 11504

Answers (3)

CodeWizard
CodeWizard

Reputation: 141946

With --contains, shows only the branches that contain the named commit (in other words, the branches whose tip commits are descendants of the named commit)

--contains []
Only list branches which contain the specified commit (HEAD if not specified)

git branch --contains <commit/tag/branch>

enter image description here

Upvotes: 5

Oleg Borodko
Oleg Borodko

Reputation: 116

You can use gitg for this. See also visual editor.

Upvotes: 1

SzG
SzG

Reputation: 12609

git branch --contains <branch>

will print all local branches where the commit labelled by <branch> is an ancestor.

Upvotes: 18

Related Questions