Search code examples
gitbranchversioning

See any Git commits directly to master?


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?


Solution

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