Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Problem after trying to add branch from other repository

Marks Afanasevics
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!
September 6, 2019

Hi!

I have a strange problem here :)

I tried to push other repository from github to my bitbucket repository branch, but I incorrectly choose branch and github repository are pushed to my master. I know, this is strange, but actually I wanted two repos in my bitbucket (just in different branches).

Now, I have problem with history. In commits history I see a lot commits from github, when I choose commit, it shows that it is from master, but in master is only my commits.

I don't know to fix this issue. I can't delete these commits, because git can't see they in master.

1 answer

0 votes
Julius Davies _bit-booster_com_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 6, 2019

If I am understanding correctly, local "master" is correct, but "origin/master" is incorrect?

From your local clone try this:

git fetch
git log origin/master

If the "git log origin/master" result matches the branch you want to delete (since it's this 'master' you accidentally pushed from the wrong repository), you can delete it like so:

git push --delete origin refs/heads/master

 

And then push back up the correct master (the local master), like so:

git checkout master
git push

 

If your local master was a bit stale it might be better to find someone else on your team that had a more up-to-date version and push from their clone.   Alternatively, it might be possible to get Atlassian Bitbucket customer support to help you recover from the bad push.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events