LucTst
LucTst

Reputation: 45

How to check if all my branches are equal to master branch?

I would like to know if there is a command which can check if all my branches are equal to the master branch.

I have a Github repo and I have many branches and sometimes I forgot if I did a "git rebase" on a given branch. For now it's okay, but later I will add many branches and it's boring to check each branch.

If someone has the solution, thanks :) The Github repo

Upvotes: 2

Views: 1779

Answers (2)

schmittlauch
schmittlauch

Reputation: 147

If I understand your requirements correctly, git branch --no-merged HEAD (given you're currently on master) might be what you're looking for:

from the git-branch manpage:

--no-merged [< commit >]
Only list branches whose tips are not reachable from the specified commit (HEAD if not specified). Implies --list, incompatible with --merged.

Otherwise you can just loop over all branches output by git branch and do a git diff agains master for each one

Upvotes: 2

VonC
VonC

Reputation: 1323135

Locally, you can use git merge-base to compare your branch with master: if the result if master HEAD, that means your branch is equals to or rebased onto master.

You can see an example applied to all branches in "Is it possible to filter out merged branches in git for-each-ref?"


On GitHub, you can compare branches, but that would have to be done branch by branch.

Upvotes: 1

Related Questions