Chapter 6. Tracking and updating files in Git

 

You’re now the proud owner of a Git repository. You’ve successfully added a single file into it. You can view the contents of your repository. It’s now time to dive a little deeper into how to update and keep track of changes that you make to files in your repository. This is clearly one of the most important features of any version control system!

In this chapter, you’ll create a new repository and then add files by using git add and git commit. You’ll learn about the git diff command, which will help you keep track of what you’ve changed in your repository as you’re working. You’ll then dive into the staging area, one of the special features of Git that enables you to commit parts of your changes into the repository. This is a use case that comes up often, and Git’s support for this is worth learning. Finally, you’ll see how Git GUI provides these same operations.

6.1. Making simple changes

In this chapter, you’ll be working in a new repository in which you’ll build a simple program that adds two numbers.

6.1.1. Creating a new repository

Let’s make an entirely new repository and put one file in it.

6.2. Thinking about git add

 
 
 

6.3. Adding multiple files

 
 

6.4. Lab

 
 
 

6.5. Further exploration

 
 
 

6.6. Commands in this chapter

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest