user3304698 user3304698 - 2 months ago 12
Git Question

When I fork a repository can I disconnected the fork from the original project

I have a base repository for all my projects, I want to fork from that for all new projects but NOT stay current with the original fork.

I can do this by just cloning the original project and changing the origin of the project to a new repository.

But I am wondering if a more elegant solution exists.

My current workflow is on bitbucket.

One of the issues with the clone process is it does not force new projects to be current, the user can just copy the old clone and change origin.

Really all I want to do is fork and then disconnected the new repository with the one it was forked from.

This would remove the default pull request behavior, that is pull requests default to the old repository.

This would also cause the new repository to not be able to be synced with the old one.

Answer

Really all I want to do is fork and then disconnected the new repository with the one it was forked from.

Instead of forking via the web interface, do it manually.

  1. Clone the existing project: git clone.
  2. Create a new project on Bitbucket (or wherever).
  3. Change origin on your clone to the new Bitbucket project: git remote set-url origin <new-url>.
  4. git push

As far as the Bitbucket web interface is concerned, this is a new project with no attachment to the old one. In reality they probably share the same disk space on Bitbucket since they share the same objects, but this is just an internal space saving measure.

I think this is what you're already doing and, while it would be nice if Bitbucket offered a "detach" button for forked projects, it's plenty "elegant".

You can always sync with the old one if you want to by adding a remote to the old project. git remote add old-project <old-project-url>