fix(repo create): clone instead of git init when --readme is used
Summary
- When
--readmeis passed, GitLab initializes the repository server-side with a commit on its default branch (e.g.mainon GitLab.com). Previously the command rangit initlocally, leaving the local repo on a different branch (typicallymaster) than the remote before any work was done. - Now when
--readmeis used and the directory isn't already a git repo, the repository is cloned after creation so the local branch always matches the remote. - Updates flag descriptions for
--defaultBranch,--readme, and--skipGitInitto accurately reflect their behavior.
Test plan
-
glab repo create --readmein an empty directory — local branch should match GitLab default -
glab repo create --readme --defaultBranch develop— both local and remote should be ondevelop -
glab repo create(no--readme) — existing behavior unchanged, GitLab adopts first pushed branch -
glab repo create --readmein an already-initialized git directory — remote is added, no clone attempted - Unit tests pass:
go test ./internal/commands/project/create/...
Closes #7847 (closed)
Edited by Kai Armstrong