git push failed with error remote: The push is attempting to remove commit

Viewed 500

Currently I am working in a setup where individual features are being developed in separate branches and all are being merged to one single main branch.

While syncing the feature branch with main branch, I am getting the below error during push to the remote. Before push, I executed following commands

> feature1_branch$ git push                   #0 : feature1 work pushed
> main_branch$     git merge feature1         #1 : feature1 merged to main
> main_branch$     git merge feature2         #2 : feature2 changes merged to main
> main_branch$     git pull                   #3 : to get all other feature changes to main
> feature1_branch$ git pull                   #4 
> feature1_branch$ git merge main_branch      #5 : to make the feature1 branch aligned with main
> feature1_branch$ git push                   #6 : error

The error at #6 is as below :

remote: The push is attempting to remove commit <commit sha> from ref feature1_branch.

Please note that the commit-sha being displayed in error message is committed to feature_branch first and the same is merged already.

Any help would be appreciated. Thanks in advance.

0 Answers
Related