Ramil Muratov
Ramil Muratov

Reputation: 546

How to avoid returning of deleted code after merge?

In our team we struggle with such situations:

  1. Two or more developers create branches from current develop.
  2. One of them deletes some code and pushes.
  3. Lead merges this branch to develop.
  4. The other developer pushes his branch.
  5. Lead merges this branch to develop.
  6. Code, which first developer deleted, returns.

How to avoid it?

Options I see:

Upvotes: 0

Views: 505

Answers (1)

John Zwinck
John Zwinck

Reputation: 249582

The problem is here:

  • Lead merges this branch to develop.
  • Code, which first developer deleted, returns.

A merge does not restore deleted code unless it is being done in a very strange way (e.g. by copying files manually).

If Developer A makes a change which is "Delete code X" and Developer B makes some other change, merging the two does not restore X. If that's happening you'll need to analyze in much more detail the workflow of the person doing the merge, and of course you can view in detail all the commits in the main repo now.

Upvotes: 4

Related Questions