![]() ![]() > api.list_repo_refs( "bigcode/the-stack", repo_type= "dataset") The repo_id is your namespace followed by the repository name: username_or_org/repo_name.Ĭopied > from huggingface_hub import list_repo_refs Create a repositoryĬreate an empty repository with create_repo() and give it a name with the repo_id parameter. Your username namespace) or from organizations in which you have write permissions. ![]() You can only manage repositories that you own (under The first step is to know how to create and delete repositories. In the rest of this guide, we will assume that your machine is logged in. If you want to create and manage a repository on the Hub, your machine must be logged in. AsĪ result, it may be more efficient to use our custom HTTP methods. Model repositories might maintain large model weight files for differentįrameworks and tools, so cloning the repository can lead to you maintaining large local folders with massive sizes. Not share the same requirements and workflows. However, software engineering and machine learning do This is valid when using the Hugging Face Hub. Might be to use git CLI to clone your repo ( git clone), commit changes ( git add, git commit) and push them Options like -single-branch are there to help avoid this: this is sometimes useful for a very large repository, or one that has huge tarballs committed under specific release names, or whatever.ĢWhether and when a newly created branch has some upstream pre-set is both configurable and controllable via options like -track and -no-track this assumes the usual defaults and commands without options.If you are used to working with platforms such as GitLab/GitHub/Bitbucket, your first instinct But to a first approximation, the default is "get all the commits". It does not copy refs/replace/ commits from git replace, nor commits found only through refs/stash or other special names. So git clone normally does not copy pull request commits on GitHub, which are under a GitHub-specific name-space. Git only really cares about the commits.ġMore precisely, the default is to copy all the commits and tags that have branch or tag or other normally-useful names by which they're found. Since branch names don't really matter-except when it comes to finding commits and keeping humans sane-Git can do this for you, as long as you have the right commits. In other words, the default "guess" mode means: check out the existing branch, or create a new one if you can. The -guess option says: before you complain that there's no such branch name, go look at my remote-tracking names and see if there's exactly one that matches up, and if so, create a new branch name for me, using the commit specified by that remote-tracking name, and setting up the remote-tracking name as the upstream of my new branch. The same applies to the newfangled git switch. ![]() This is less efficient, but computer efficiency is often irrelevant here: what's an extra 2 or 3 seconds when your git clone's git fetch step takes 50 seconds to retrieve all the commits? (assuming that you'd like to have main checked out and that this is what git clone is going to check out as its last step). Now you still have nothing checked out yet, but you have main, feature, and dev all set up with origin/main, origin/feature, and origin/dev as their upstreams, ready to use.įor b in feature dev do git checkout $b done & git checkout main\ Now you can enter the new clone and create a branch name for each remote-tracking name for each branch name that you want to have: cd new-cloneįor b in main feature dev do git branch -track origin/$b done This way, you'll get all the commits-and remote-tracking names for all of their branches-but no branch names of your own, and no commit checked out yet. What you probably want in this case is: copy all commits, then don't create any branch names. (Remember or realize here that git clone consists of running mkdir, git init, git remote add, git fetch, and so on it's the git fetch step that copies the commits, and the default is to copy all commits. Using -single-branch, -depth, and the newfangled partial clone features is a way of telling your (client) Git not to fetch all the commits from the repository you're cloning. That said, we find commits by branch names-unless you're crazy enough □ to use raw hash IDs that is-and git clone, once it's done cloning some or all commits, creates one branch name, so it "feels like" you're cloning a branch. Git is all about commits, so nearly everything you do is all about commits. The trick here is to realize that, in a way, you don't clone branches in the first place. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |