eolas/neuron/233bf7c7-59e9-471c-8275-895571468b75/Identify_merged_branches.md

59 lines
684 B
Markdown
Raw Normal View History

2024-10-19 11:00:03 +01:00
---
tags: [git]
---
# Identify merged branches
```sh
# View merged
git branch --merged
# View merged remote
git branch -r --merged
# View unmerged
git branch --no-merged
# View unmerged remote
git branch -r --no-merged
```
The above cases run the merge check from the point of view of HEAD as this is
the default.
But we can also run it from any branch.
```
git branch --merged non_head_branch
```
## Demonstration
We have the following branches
```
git branch
* main
key_feature
another_feature
```
The branches other than `main`, have not been merged:
```
git branch --merged
* main
```
Just to confirm:
```
git branch --no-merged
key_feature
another_feature
```