Conversation
… repo-create-rewrite
… repo-create-rewrite
… repo-create-rewrite
vilmibm
left a comment
There was a problem hiding this comment.
this is coming along very well~
mislav
left a comment
There was a problem hiding this comment.
Getting close! I've tested this locally and I love how easy and clear it is to use via explicit command line flags.
mislav
left a comment
There was a problem hiding this comment.
Looking great!
Some results from my QA testing:
-
gh repo create --source . --private --template a/b- I have expected this to error out, but the template flag seems to be ignored. -
gh repo create myrepo --source /tmp --private- Since/tmpis not a git repo, this fails, but the error message is misleading:fatal: not a git repository (or any of the parent directories): .git. The error message does not ever mention that/tmpwas an invalid git directory, but perhaps it should? -
gh repo create myrepo --source . --push --private- My local git repo has no commits, so I have expected this to fail with a descriptive error message, but I get:error: src refspec HEAD does not match any. The remote repo was created and added as a git remote, but I don't think the git error message is descriptive enough for the average user to realize what went wrong. Furthermore, retrying the command (perhaps after creating a git commit) will fail because the remote repo already exists. Perhaps--pushshould fail early if there are no commits?
I made the errors more descriptive by catching the 128 exit code from git. Let me know if you see any bugs or if the code can be improved The command will now fail immediately if |
mislav
left a comment
There was a problem hiding this comment.
Updates look good! Thank you for the hard work 🙇
This PR rewrites
gh repo createfollowing #4567 to fix bugs, improve UX, and add requested features (Ref: #2184).Fixes #2166, Fixes #893, Fixes #2059, Fixes #2077
Changes
Interactive mode is only for
gh repo createwith no arguments. Otherwise, all arguments must be passed explicitly.The new command is backward compatible for scripting purposes except:
--cloneflag--sourceflagFor example, running
gh repo create myrepo --publicin a local repository will no longer add a remote. It assumes you just want to create a new repository on GitHub. To create a remote repo from your local git repo, usegh repo create myrepo --public --source=.insteadFlags
The following flags are deprecated:
--enable-wiki, replaced by--disable-wiki--enable-issues, replaced by--disable-issues--confirmThere are additional new flags:
--source: specify the path to the local git repo--remote: specify the remote name to add (used with--source)--push: push local commits to the new repo (used with--source)see #4567 for more info
Todo
--templatehas no bugs (Ref: "gh repo create --template" creates an empty repository locally #2290)--templatecloned empty repositorywarning--cloneand--pushin case authentication is needed--source,--remote, and--push,--clone