Question: Using github.com can collaborators be prevent from 'commit to master'?

We’re new to github using github.com as interface. We found that when you ‘drag and drop’ copy a file to the web interface, the default action is ‘commit to master’, and that this can lead to overwriting files.

We talked about checking out files, but that doesn’t seem to be possible in the web interface.

Can we do something like this:
Disallow direct commits to master: https://github.com/nvie/gitflow/issues/330#issuecomment-24462422, and have it work from the webinterface?

It’s a personal public repository.

1 Like

Hi @blenderisland, Welcome! We are happy you are here. You can absolutely accomplish this by enforcing branch restrictions. Once restrictions are enabled on your master branch the default behavior for drag and drop imports will be to create a new branch and open a pull request. Here is what one branch protected as such looks like:

I hope this helps!

1 Like