Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fork your own repo on BitBucket?

Tags:

fork

bitbucket

How to fork your own repo on BitBucket ?

I know how to fork another user repo from web interface, and I know how to clone my repo.

But how to fork your own repo on BitBucket and ease a future pull request workflow?

like image 541
Y.N Avatar asked Jun 15 '17 20:06

Y.N


2 Answers

Go to your repository, and then go to Actions -> Fork.

If you have the new navigation enabled, then go to your repository, click on the + on the left navigation bar and then Get to work -> Fork this repository.

Also, make sure that forking is enabled in repository settings (for the existing repository).

like image 149
Gabriele Petrioli Avatar answered Oct 21 '22 04:10

Gabriele Petrioli


First, create a new repository 'bar'. Next, clone the existing project 'foo':

$ git clone [email protected]:YOURNAME/foo.git bar

Next, edit your Git config file and replace the origin URL with your new URL:

$ cd bar
$ vim .git/config
    [remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = [email protected]:YOURNAME/bar.git #replace foo with bar

Optionally add your original repo as an upstream source:

$ git remote add upstream [email protected]:YOURNAME/foo.git

Finally, push your new repository up to Bitbucket:

$ git push -u origin master

Now you can push/pull from your new repo (bar) as expected. You should also be able to merge upstream changes using the following command:

$ git fetch upstream
$ git merge upstream/master

credit: bitdrift

like image 21
jeppestaerk Avatar answered Oct 21 '22 03:10

jeppestaerk