Minimal forking: only clone default branch
When I fork a repository like gitlab-ce
I don't want all the branches - I really just want master in my fork. The feature branches will become stale almost instantly so there isn't any point of having them linger.
GitLab should make it easy for me to quickly fork the project but only bring over the data I actually need so that when I'm looking at the branch list in my fork I only see my branches!
I used the following command to delete all the branches I didn't need from my fork. WARNING use extreme caution to make sure you don't delete upstream remotes by getting your remote names confused!
# origin: your fork
# upstream: the parent upstream repo
git fetch -p origin
git branch -r | grep "origin/" | grep -v "master" | sed 's$^ origin/$origin $g' | xargs -L 1 echo "DRY RUN: git push --delete"
Proposal
Introduce a new section in the new fork page Branches to include
.
- There are 2 options:
Previous proposal
When a user forks a project, only fork the default branch (`git clone -b master --single-branch`) rather than the entire project.After the fork succeeds, show a tip for the next 30 minutes at the top of the page to allow the user to Clone all (like the create merge request prompt).
The docs should provide instructions for doing the backfill manually.
Links / references
Availability and Testing
Add feature specs for new forking option (if this cannot be performed in the feature specs an E2E test may need to be created). Exploratory testing of feature.