2

User A committed (1) in the "master" branch.

User B committed (2) and (3) based on (1) in the "feature" branch.

User A merged (3) into the master branch.

So now it looks like this:

  • hash3 - (origin/master, origin/feature) commit 3 (User B)
  • hash2 - commit 2 (User B)
  • hash1 - commit 1 (User A)

Now it appears like User B has committed into the master branch. But he didn't. It looks like this only because User A has merged. But there is no record of this merge. Only the commit is shown.

Is there any record that views this commit as two different actions (commit then merge) done by two different users instead of just showing them as one thing?

Omar Mokhtar
  • 53
  • 1
  • 4

1 Answers1

2

It sounds like you have a scenario when one user is fast-forwarding the master branch from a feature, and in the process is bringing in commits which were done by another developer. There is no trail left behind of this, so it would appear that two developers made those commits, when in fact the fast-forward was done by a single developer.

There is a way to force a merge commit even when a fast-forward would occur, and a merge commit would not be required. If you were planning to merge feature into master, you could guarantee a merge commit by using the --no-ff flag:

git checkout master          # switch to master
git merge --no-ff feature    # merge feature into master; force merge commit

Of course, if you are using something GitHub or Bitbucket, this merge might be taking place on the repository itself. In this case, you would have to configure your specific provider to do this.

Reference: Why does git fast-forward merges by default?

Community
  • 1
  • 1
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360