Reputation: 4231
I have dev, test, rc, master branches in my repository on GitHub. Is there a way to prevent my branches from getting deleted by other developers?. Also is there any way to know who has deleted the branch?. Thanks
Upvotes: 2
Views: 860
Reputation: 55803
You can't prevent other developers with push-access to the repository from deleting branches.
That said, even if someone deletes a branch, the data is not immediately lost. It is still kept around for some time. So if you still know the commit a branch pointed to, you can restore the full history for about 2 weeks.
Also, Github keeps a log about all push activity on a repository which is accessible on the web. Unfortunately, as far as I'm aware, this is not available on the repository view directly but only in the activity feed of the individual contributors. Thus, you could e.g. subscribe the activity feeds of your contributors.
Generally however, it is probably a better idea to only give those people commit access who you trust to not mess up your repo. There are many more ways to wreak havoc in a repo than to just delete branches.
Upvotes: 2