2

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

Don Branson
  • 13,631
  • 10
  • 59
  • 101
LucTst
  • 45
  • 8

2 Answers2

1

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

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

schmittlauch
  • 127
  • 6