Chapter 3. Making a Commit
[ 3 ]
Making a Commit
In the last chapter, you learned about the different areas you will interact with when working with Git: the working directory, the staging area, the commit history, and the local repository . We built a Git Diagram of these areas, and you ended the chapter by adding the first file to your rainbow project directory. In this chapter, you will go through the process of making a commit in the Rainbow project and observe how each of the areas in the Git Diagram is involved. I will also introduce two important commands that will assist you in your day-to-day work with Git. The first command will allow you to check the state of your working directory and staging area, and the second will allow you to view a list of commits. |
Current Setup
You now have a project directory called rainbow that has a .git directory inside it, and you also have one file, called rainbowcolors.txt, in your working directory. The staging area and commit history are empty because you have not yet made any commits in the rainbow repository. This can all be seen in Visualize it 3-1.
[ Visualize it 3-1 ] |
The rainbow project directory at the start of Chapter 3 has one untracked file in the working directory |
Why Do We Make Commits?
In Chapter 2, you learned that a commit basically represents one version of a project. Every time ...
Get Learning Git now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.