gitgit-fork

When should I choose 'copy the main branch only' option when forking in git?


I'm learning git and I wanted to fork a repository. The video from which I'm learning it was posted few years ago and the option doesn't emerge.

When should I choose this option? And when shouldn't?

I did some research but didn't find any inofrmation as to when I should do this and when shouldn't. I only saw that this option is now available

enter image description here


Solution

  • Some Git project have quite a large amount of branches.

    When forking a repository, that checkbox allows you to only fork the main branch.

    Depending if you need those branches besides master, you can choose not to clone them.

    Lets say you want to continue work on branch feature-FOO, then you'll need it, but are you just forking to start a new branch from master, then there is no need to fork all the branches.


    So to add an example, forking ffmpeg with that option enabled will (currently) prevent another 35 branches from being forked, which when not needed will keep your branch list a lot smaller.