1

I cloned a github repository into our Bitbucket account. Similar to https://gist.github.com/sangeeths/9467061.

I fixed a bug in my repository located in bitbucket. I'd like to open a pull request on the original github repository that fixes the bug.

If my fork were located on github, I would simply follow these instructions, but since my fork is on bitbucket, I don't know where to start.

How can I open a pull request from my bitbucket repo to the original github repo ?

Lorenz Meyer
  • 19,166
  • 22
  • 75
  • 121

1 Answers1

1

You can:

  • clone the original GitHub repository to a different folder
  • add your local BitBucket repo as a remote
  • fetch your fix branch (make sure you fix is done in its own branch, not master)
  • create a PR using the cli/cli GitHub command line interface gh pr create

That is:

git clone https://github.com/original/repo
cd repo
git remote add bb ../yourLocalBitbucket/repo
git fetch bb
git checkout bb/fix
gh pr create

The gh pr create command will do the work for you:

When the current branch isn’t fully pushed to a git remote, a prompt will ask where to push the branch and offer an option to fork the base repository.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • It'd be cool if `gh` can support all `git` commands so I don't have to alternate between `git` and `gh`. But I guess it can be solved by using alias. – NearHuscarl Sep 28 '20 at 11:57
  • @NearHuscarl True. I suspect it is because `gh` is really oriented to GitHub, while `git` remains... well, for Git. – VonC Sep 28 '20 at 12:02