1

Following situation:

Some branch encoder_dev has been merged into a branch encoder. encoder has been merged into integration, integration has been merged into master. All the merges were true merges. The branch encoder_dev has got another commit.

The corresponding commit graph:

* ed9c5fa07889eb9db1294ef92efd75ea42df0143 (HEAD -> encoder_dev) [encoder_dev]: added signal C
| *   73ec0451e9ac23909fa6558c22a9996a2001fb1c (origin/master, origin/HEAD) included encoder changes
| |\
| | *   257e2dbfb16afb07cded3e17416048863be22e77 (origin/integration) Merge remote-tracking branch 'remotes/origin/encoder' into integration
| | |\
| | | *   0608a1965b10015d3b03d84e4cd2610c8f098f24 (origin/encoder, encoder) initial implementation
| | | |\
| | |/ /
| |/| /
| |_|/
|/| |
* | | abbbb126781839e3ff74282666515c9a547ff963 (origin/encoder_dev) [encoder_dev]: added entity and architecture
|/ /
* |   ef425daf81becbe1e2fd5ae92d099d189cc3dbe0 (master) initial checkin; all files are empty
|\ \
| |/
| * 886e3783af21fe4138614f26b53c705839749b00 [integration]: added FILE_HISTORY to each file
|/
* cabcd5630133ebaac4f505e9f3759ae0e448cfac [***]: initial checkin

Now, origin/master could transport contributions from other branches, but in this case it doesn't. If I merge origin/master into encoder_dev, it would not contribute any new information to encoder_dev, since the only changes to the code were made in the last commit to encoder_dev, all the previous changes landed in origin/master, and origin/master had no code changes since then. Note that fast-forward is not possible. Is there a way to detect this case automatically?

Andy
  • 634
  • 7
  • 19
  • According to this graph, `master` can be fast-forwarded to `encoder_dev`. I'm not sure why you think it can't. – mkrieger1 Sep 14 '20 at 15:10
  • git merge --ff-only origin/master returns "fatal: Not possible to fast-forward, aborting." – Andy Sep 14 '20 at 15:17
  • I'm confused by your terminology. I just performed "git merge origin/master". The result in log is: "Merge remote-tracking branch 'origin/master' into encoder_dev". – Andy Sep 14 '20 at 15:24
  • sorry! I was wrong :( sorry for confusing you... – mkrieger1 Sep 14 '20 at 15:25
  • Still, `origin/master` is a different commit than `master`. If you mean `origin/master` you should make this more clear. – mkrieger1 Sep 14 '20 at 15:26
  • no problem :) good point, thanks! – Andy Sep 14 '20 at 15:27

1 Answers1

0

You can check the differences that landed on origin/master since the fork point between encoder_dev and origin/master :

git diff encoder_dev...origin/master # 3 dots notation

# the above is a shortcut to :
git diff $(git merge-base encoder_dev origin/master) origin/master

In your case, it should yield a completely empty diff, meaning that no other modifications were integrated to master since the last merge between encoder_dev and origin/master.


One extra remark :

unless you have a very good reason to keep two distinct branches encoder and encoder_dev, you can probably add your new devs straight to the encoder branch.

LeGEC
  • 46,477
  • 5
  • 57
  • 104