This article shows how to fork your own repository on Gitlab. This will work with GitHub and Bitbucket.

  1. Create a new repository on GitLab (let’s call it Child). Let’s assume your repo that you want to fork is called Parent

  2. Clone the Child repository to your local machine git clone<username>/child.git

  3. CD into your Child repo cd child

  4. Create a new ‘project-work’ branch git checkout -b project-work

  5. Add the Parent repo as an Upstream Remote git remote add upstream<username>/parent.git

  6. Pull the Parent repo into your Child repo git pull upstream master --allow-unrelated-histories

You may get the error, fatal: refusing to merge unrelated histories - be sure to add ‘–allow-unrelated-histories’ to the upstream command

  1. Merge your work into your Child master branch git checkout master git merge project-work

  2. Finally, finish your work. Add and commit your work and push to your Child repo. git push origin master