Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 649
Sofiane REBIB Avatar asked Oct 06 '18 16:10

Sofiane REBIB


1 Answers

git log --cherry-pick develop...origin/release
  • The three dots between the branches ... means that you want to retrieve distinct commits from the two branches
  • From official documentation --cherry-pick option does :

"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."

like image 84
Woody Avatar answered Sep 29 '22 04:09

Woody