Search code examples
gitbitbucket

Bitbucket issue when creating pull request


I had created a feature/abc branch from master.Then I merged branch to master using git-bash. I followed below steps:

git checkout master
git merge feature/abc
git push origin master

Then I checked the bitbucket and my branch was merged. But, then I realized I had to create a pull-request and get code reviewed. So, I tried to remove the feature branch merge to master after already pushed to origin master.

Steps followed:

git checkout master
git log // to get my feature/abc <commit-hash>
git revert -m 1 <commit-hash>
commit the reverse. git commit -m "Revert merge of feature/abc"
git push origin master

Now, when i check bitbucket I see "Revert merge of feature/abc". My changes from feature are gone from master in bitbucket. But, when trying to create a pull request from feature to master I get:

Branch "master" is already up-to-date with "feature/abc" in repository my-proj.

Solution

  • master already includes all commits from feature/abc, even if master has moved on since then. Add new content to feature/abc (whitespace? comments? other documentation?) and push it up to the remote.

    BTW, you should really consider branch protections on master to enforce code review in the future.