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. The existing commits remain, and are findable-or not findable-by starting from some named commit and working backwards.In some contexts, but not all contexts, origin means origin/HEAD. As you add more commits to the repository, you can make the various branch names point to different commits, and/or add new branch names. You may now rename it, and/or create as many more branch names as you like, though all must select this same commit. Once you've created your first commit, your initial branch name now exists. Making the first commit creates the branch with that name-so until you make the first commit, you can change the name as much as you like: you're changing the name of the branch that doesn't exist. You're just on a branch that doesn't exist. Nonetheless, you are, in such a repository, "on" some branch. This means that in a new, empty Git repository, with no commits in it, no branch names exist.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |