Git missing code after merge

We have a problem with our GitHub repository. I will explain our workflow:

Developers create function / error commit branches from the mainline branch. They pull a request for their changes to merge it back. They can be reinstalled from the mainline branch to receive the latest updates from this when they work. After reinstallation, they click on their functional branch.

The two download requests have been automatically merged using the GitHub web interface recently. Subsequently, approximately two days after the merge of the request, it was discovered that changes to these commits were not in the code. Nothing in the story suggests that these changes were canceled or overwritten. Mergers of themselves do not appear in the history of fixation, and individual themselves do not appear. But the retrieval request was successfully merged. One of the missing commits is no longer available for picking cherries. When we try, we get a fatal bad object message.

We suspect a census of history has occurred. How can we find out and how can we prevent this. Is there something fundamentally wrong with our workflow?

+6
source share
1 answer

The problem you are having is that your developers are recharging from the main branch, and then forcing their own branches. What git rebase really does is that it git rebase all the changes you made, merge the main branch, then reapply your commits (as if they were patch files). This will create a completely new git commit with a completely new hash.

In short, the old commit was lost and a new identical commit was created.

That is why it is highly discouraged to cancel any public work, because you are effectively changing the story. Any people who are forked from your work will have a very bad day if their work is based on changes that are no longer available.

edit: the commit is not lost on its own, it still exists in your repo. However, it is no longer available on the corresponding branch.

0
source

All Articles