![]() Git then does something about that last commit, such as: show us the author's date and name-and-email and log message. We typically start Git at the last commit, or more precisely, the last commit in some branch. ![]() This parent-or first parent, for merge commits-is how Git works: backwards. There are four kinds of Git objects in a repository, but mostly, we deal with the commit objects, and get to ignore the others. It's like a party: the name Bruce might be unique if there are only ten people there, but once you're up to 10,000, you probably need at least a last initial too. ![]() As you add more and more objects to a Git repository, each of which gets one of these unique-to-that-object IDs, it becomes more and more likely that you need to use a more-full name to tell them apart. Typically there is only one of these root commits all others have history.ġThese things look random, but really are not random at all. At least one commit-the very first one anyone ever made in the repository-necessarily has no parent, because there's no commit that comes before the first commit. Some have two or more, in which case the first parent is the interesting one here. One piece of this metadata is for Git itself, and it gives the hash ID of the commit's parent commit-the commit that comes right before the commit itself. We won't go into much detail here.Īnd, each one stores some metadata: information such as who made the commit, when, and why (the log message). 1Įach one stores a full snapshot of files. Lots of Git commands abbreviate these-you can sometimes go as short as the first four characters, 4a0f for instance, as long as that isn't ambiguous, but in a big repository you'll usually need 7 or more characters (and the Linux repository is up to 12 now). There are three big features about commits:Įach one has a unique ID. There's a recurring theme in Git: you make a commit ( git commit), you find a commit (many ways), you show a commit ( git show or sometimes git log), you check out a commit ( git checkout or git switch), and you look through or at commits ( git log again). maybe not so quick) trip through how Git works internally, in this respect.įirst, the big central thing in Git is the commit. I'm confused about what these each do, how they are different, and which one is the answer to my question: To (I hope) help you understand this part, though: ![]() Printf "%s %s " $name $(git rev-parse -short $name^)įor extra context, this is the reason I'm asking.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |