Unrelated branch commits history pushed

Vitalisoft
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 5, 2022

I'm working with JetBrains PhpStorm and integrated one Bitbucket and one Github remote repositories at once. Bitbucket repository was created much later, and had only one commit, with the working tree of the github master branch.

After making some changes in the github branch, I made "git checkout bitbucket" (local branch tracking Bitbucket master), "git commit", "git push".

After that, I have that one more commit in the Bitbucket master branch, but also, on the Bitbucket Commits tab, I have like a separate branch with all the commits from Github, it is before master and of different color.

However, I don't need those commits and didn't intend to push them, I also don't see them in the PhpStorm Git tab. I can't see that branch on the Bitbucket Branches tab, and when I click any of its commits, its branch is shown as "master", and points to a branch that doesn't have that commit!

How is this possible and how do I delete these unrelated commits from my Bitbucket repository?

On the screenshots you can see that "da40a66" is actually the same as "844cf5c", but created earlier

image.pngimage.pngimage.png

1 answer

1 accepted

0 votes
Answer accepted
Vitalisoft
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 6, 2022

Turns out that branch appeared when I accidentally pushed the tags from all branches (including Github master), and they pulled their history with it.

When I run "git push --delete bitbucket 4.3.0 4.0.1" (the last and first tags of the Github master), it disappeared.

Still, it was misleading to me that the branch name was "master" although it wasn't related to Bitbucket master. And it linked to the branch page that didn't have those tags, so I could only see them on the Commits tab.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events