gitgit-commitgit-cherry-pickgit-workflowgit-worktree

git compare two branches which contains some common commit with different hash


Context : We are a team of programmer who work on a project with severals branches :

Master, Release, Develop

Sometimes we need to fix a bug on release, and we need to report this fix on develop, to report our bug fix we use : git cherry-pick commit-SHA

With this command the bugfix is well reported on develop but the commit has a different hash

What we need :

Sometimes we need to know the list of commits that has not been reported, to do so, we use the command who compare the two branches and give us the list of commit which exist in release but not in develop : git log develop..origin/release

The ISSUE :

This command compare the hash of commits, but as i said before, when we report our commits, their hash changes, thus, we get some commits as if they were not been reported while they are

I'm lookin for a way to report our bugfix without changing the hash of commits, or a way to list the difference of commits between two branches, not by the hash but based on the message or another thing

Thanks


Solution

  • git log --cherry-pick develop...origin/release
    

    "Omit any commit that introduces the same change as another commit on the “other side” when the set of commits are limited with symmetric difference."