The last day of the working week was ending ...

The last day of the work week ended. I made myself coffee in the office kitchen, wondering how we would be able to reduce the queue of the request pool, which has grown greatly after the introduction of the review guide . It seems that simple rules caused a long correspondence in the comments to the pool of requests between members of the review team and the developers of the framework.

image

Nothing foreshadowed. It was getting dark.

Suddenly, a working chat rustled with messages:
- Why was my pull request removed?
- And my pull requests banged!
- And mine!

After just a few minutes of investment, we found out that this happened because someone deleted the Bootstrap work branch, where more than 40 people smuggled in for more than three months. Once again, in order to be able to realize the full extent of the problem, forty people poured code there for more than three months.

image

Colleagues immediately began to gush with ideas that we all have local copies of this branch, and let's create this branch from scratch.

From my own experience, I know that hasty decisions and improvisation do not lead to anything good, so I asked everyone not to take any action and literally "take their hands off the keyboard."

image

So, the disposition is Friday, evening, an almost empty office, a lost branch with a huge code base. If you do not solve this problem here and now, then there is a chance that the situation will become worse if other developers who do not know the current situation get connected to the weekend (we all read the working chat carefully, right? ).

I politely asked in the chat who deleted the Bootstrap branch, and one young developer, who was recently included in the work, admitted that he did it by mistake. "Sorry".

image

I grab a specialist who has successfully turned up by the arm, and we rush to a young developer who at this moment is experiencing an existential crisis, and whose workplace, by a lucky chance, is in the same office as us.

Of course, we restored the branch - a bit of git magic, and everything worked out. You can not say about more than 20 pull requests that have disappeared in the bowels of GitHub. Unpleasant, but not fatal.
Time to take a breath, figure out what happened and draw some conclusions.

image

The main question is why? The answer, in general, is trivial - by accident. Something was wrong with the code that was committed to its own working branch - nothing criminal, it was just ugly code, and even if you reverse the commit, it still remains in history. Therefore, the developer decided to demolish his entire working branch and recreate it. From scratch. And the Bootstrap branch came under a hot hand. Friday. Evening. Misklik, yes.

image

GitHub allows you to cancel the delete operation, but only until the page is updated, and this chance was not used.

Could this situation have been avoided? Yes you can. By default, anyone with write access to your repository can delete any branch. However, GitHub allows you to create a Branch protection rule for one or more branches.

image

Where it is important to make sure that the corresponding check box is not checked.

image

This was not done for the bootstrap branch, and it caught up with us.

In the dry residue:

  1. They saved the branch.
  2. Now, on any branch in which more than one person contributes, we install the Protection rule. What I recommend not to forget to do everything.
  3. Support for the BootStrap package in JDI Light, we eventually implemented and rolled out. But what it is and why - that's another story ...

All Articles