2

Let's say a dev team is supposed to commit all their changes to local branches, finish the feature inside the branch, followed by merging the branch into master.

How exactly can one find out if there were any commits made directly to master?

Rich Turner
  • 10,800
  • 1
  • 51
  • 68
RandomAndy
  • 324
  • 1
  • 9

2 Answers2

3

This will walk back the commit history of the branch master, taking the first/left parent of any merge commits (thus ignoring commits brought in by merges), and displays only those commits that are not merges:

git log master --first-parent --no-merges
TuukkaH
  • 63
  • 5
1

You can fetch the remote repo, and have a look at the logs from master: if you see commits which are only part of master (git branch --contains <commit>), then commits have been done directly on master.

You could protect your repo (if you have access to the server) against pushes to the master branch with gitolite.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250