Did a merge occur from a specific branch into master?

I have two primary branches within a Git repository – develop and master. New feature development occurs in branches off of develop, which are then merged into master for deployment.

I would like to determine if a merge has occurred from develop into master since a certain time. I’m not even really interested in the actual commits themselves, only that something from develop has been merged into master.

I have tried:

git rev-list --merges origin/develop..origin/master --since <date> | wc -l

for a period where I know there are merges, but it always seems to return a zero.

Update

Also, I have tried to build it up, step-by-step. Starting with:

git rev-list --merges origin/master --since <date>

I get all of the merges into master, both from the develop branch and any hotfix branches that may exist. It’s only when I add the ‘origin/develop’ constraint that I get nothing in the results.

  • How do you store static data in your SQL Server Database Project in VS 2012
  • Git “leaky” branches?
  • Git: Remove all revisions of a file in a repository, and replace with new file
  • Vim, LaTeX, word-wrapping, and version control
  • Does Mercurial support empty commit messages?
  • Project with multiple binaries in Eclipse CDT
  • Do all diffs get copied to source branch from destination branch during git merge?
  • What TFS folder should the solution file be bound to?
  • 2 Solutions collect form web for “Did a merge occur from a specific branch into master?”

    In order to find the last time a branch was merged in, I would use git merge-base. This shows the latest commit that both the branches have in common.

    git merge-base origin/develop origin/master
    

    This will provide the latest common SHA in both branches giving you an idea when they were last merged. You can pipe the commit SHA into git log and see the last commit.

    git merge-base origin/develop origin/master | xargs git log -1
    

    If you want to see all the commits on the branch since this SHA:

    git merge-base origin/develop origin/master | xargs -I sha git log sha..origin/develop
    

    With this you will be able to see a list of all the commits made on origin/develop that are not yet on origin/master.

    Another option should be:

    git log --merges --since=<date> --oneline origin/develop..origin/master
    
    • –merges tells log to only show merges
    • –oneline is optional and formats the output
    Git Baby is a git and github fan, let's start git clone.