Search code examples
gitversion-controlgit-mergegit-log

Git - Log commits of dev except which are cherry-picked into main


I have dev and main branches. Some commits go to the dev branch and then some of the dev branch commits go into the main branch. Which means, there are several commits in dev branch which are not submitted/cherry-picked in main branch at any given time.

I wonder if there is a way to log all dev commits which are new or which are not cherry-picked into main.

I tried with,

$git log main..dev
$git log dev..main

but they don't serve my purpose.


Solution

  • You can rebase in your local clone of the repo your dev branch on top of main: any commit already cherry-picked would not be replayed on top of main.

    Or, simpler:

    git cherry -v main dev
    

    This would show all of the commits which are contained within dev, but not in main.
    See "Git log to get commits only for a specific branch".