Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

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 has 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?.

1 Answer

0 votes
by (50.2k points)

You can get the list of commits in a branch you can use 

git branch --contains <branch-name>

Which will show you the commits that are specified in the branch? If you get more than one branch name then it means the branch is merged.

Alternatively, you can use 

git log <current-branch> <merge-branch> 

This will show you what current-branch needs to have everything that merge-branch has.

 Reference: https://git-scm.com/docs/git-branch#Documentation/git-branch.txt---containsltcommitgt

Browse Categories

...