1/11/2024 0 Comments Git status stagedYou’ll create a change to a file, see how Git acknowledges that change, how to stage that change, and, finally, how to commit that change to the repository. The easiest way to understand the process of building up commits is to actually create one. This may seem like a bit of a heavy approach, at first, but, as you move through building up your commits, you’ll see how each step helps create a workflow that keeps you in tune with the files in your repository and what’s happened to them. In Git, there are a few steps between the act of changing a file and creating a commit. The diff is the difference between the above two commits.Īnd a diff doesn’t just have to be additions to files creating new content, modifying content and deleting content are other common changes that you’ll make to the files in your repository. The diff between them are the changes I made to a single file: The parent commit is the left-hand file, and the child commit is the right-hand file. In this example, I’ve added new text to a file between commits. The diagram below explains this a little more:Įxample of two commits, the parent on the left, and the child on the right. After you commit your changes - which is the diff - that next commit would be the child commit. The state of the repository before you began those updates - your starting point, in effect - is the parent commit. You’d like to capture that bit of work as a commit into your repository. Imagine that you’re adding new items to your ideas lists, and you’ve added as many as you can think of. Generally, a commit represents some logical update to your collection of files. Note: If you didn’t complete the challenge for the last chapter, then go create a fork of and clone it to your local workstation.Ĭlick that link, and you’ll see a bit of the history of this repository:Įach of those entries is a commit, which is essentially a snapshot of the particular state of the set of files in the repository at a point in time. To start, head back to the homepage for your forked repository at /ideas, and find the little “11 commits” link at the top of the repository page: What is a commit?Īs you’ve probably guessed by now, a Git repo is more than a collection of files there’s quite a bit going on beneath the surface to track the various states of your changes and, even more importantly, what to do with those changes. Once you’re done making your changes, you’ll need to tell Git that you want to commit those changes into the repository. You’ll need to stage the changes to your files, so that Git knows about the changes. That’s great!īut, clearly, just making the changes to your local files isn’t all you need to do. At this point, you’re ready to start making changes to your repository. The previous chapter showed you how to clone remote repositories down to your local system. Section I: Beginning Git Section 1: 11 chapters Show chapters Hide chapters
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |