![]() In your case, the working tree is everything inside your ideas directory. Git status shows you the current state of your working tree - that is, the collection of files in your directory that you’re working on. Don’t believe me? Execute the following command to see that Git knows what you’ve done, here: git status In the background, Git is watching what you’re doing. When you’re done, save your work and return to your terminal program. Advanced debugging and reverse engineering Your file should look like this: # Ideas for new book projects I like to use nano since it’s quick and easy, and I don’t need to remember any obscure commands to use it.Īdd a line to the end of the file to capture a new book idea: “Care and feeding of developers.” Take care to follow the same format as the other entries. Open books/book_ideas.md in any plaintext editor. Note: If you missed completing the challenge at the end of the Chapter 2, go back now and follow the challenge solution so that you have a local clone of the forked ideas repository to work with.Īssume that you want to add more ideas to the books file. This should be the clone of the forked repository that you created in the previous chapter. Open your terminal program and navigate to the ideas repository in my case, I’ve put it inside of the GitApprentice directory. ![]() You’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. > git -c user.Section I: Beginning Git Section 1: 11 chapters Show chapters Hide chapters I observed the VS Code behaviour by the git log window and I discovered that both commit and commit all option, it logs a git add -A.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |