O'Reilly logo

Pragmatic Version Control Using Git by Travis Swicegood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding Files

You’re constantly adding new files and making changes to your repository’s contents. git add fills both of these roles. Just give it the name of a file or the files you want to add, and Git stages the changes to commit.

Before we proceed, there is a little terminology to clear up. Staged changes are simply changes in your working tree that you want to tell your repository about. When you stage a change, it updates what Git refers to as its index. A lot of people, myself included, refer to it as the staging area.

The staging area is just that, a place where you can set up commits prior to committing to your repository.

“But isn’t this double the amount of work? Why can’t I just commit?”

In a lot of cases, yes, it is double ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required