![]() ![]() Either way, we need to reach out to that URL and obtain their commits. We can make a new, totally-empty repository and do this and get a clone of the Git repository for Git. 4 If is a Git repository (and it is), and we use git fetch to call it up, we can have our Git software get, from their (GitHub's) Git software, any new to us commits that exist at that location, that we do not have yet, and put those in our own repository. A remote is a short name 3 under which Git can store various pieces of information, with the main required piece being the URL at which your Git can reach some other Git software. So, for git fetch, the first numbered (positional) argument, origin or github in the examples above, specifies a remote. After consuming the various flags, the remaining arguments are positional arguments and are numbered. The front-end git command defines what flags it takes, but each verb defines what flags it takes. Where the verb is one of the various Git commands, such as branch or checkout or commit or fetch or ls-remote or reset or whatever. Meanwhile, some options-like -C to git itself, and -m to git commit-need an additional argument, so they "eat" the next word, but others, like -symbolic-full-name to git rev-parse do not need any additional argument and do not eat the next word. The git command takes the -C and path/to/repo for itself, and then passes -symbolic-full-name and HEAD to the rev-parse verb. Moreover, some flags are for the git command itself: for instance, with git -C path/to/repo rev-parse -symbolic-full-name HEAD ![]() A flag argument like -m or -hard does not "count" in terms of positions positional arguments do get counted. Git then uses its own peculiar mix of POSIX and GNU conventions to decide which of these various arguments are flag arguments and which are positional arguments. The quotes are gone by this point but the white-space (space character, in this case) remains. 1 This CLI will break up arguments at white-space, so that fetch, github, and +refs/pull/123/head:refs/heads/pr123 are separate arguments to the last command however, quotes can defeat this breaking-up, so that git commit -m "commit message" comes through with arguments commit, -m, and commit message. The git program expects to be invoked via some sort of command line interpreter (CLI), which we call a shell for obscure reasons. Or: git fetch github +refs/pull/123/head:refs/heads/pr123 You might, for instance, run: git commit -m "this is a bad commit message" ![]() To understand this, let's look at how Git uses arguments. They are not always interchangeable, though. While origin/master and origin are clearly different (one has /master on the end!), they're doing the same thing with your particular repository for this particular operation. In some contexts, but not all contexts, origin means origin/HEAD.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |