How can I add changes to the staging area?


#1

Question

The third step of this exercise asks me to add the changes to the staging area in Git, how do I do this?

Answer

Recall that we do git add <filename.extension> to add a file to the staging area.

If our file name was ‘homework.txt’, we’d type git add homework.txt and, if it was successful, nothing would happen in the terminal after pressing enter. If there’s an issue, Git will usually print a handy error message that sometimes include steps to fix the issue or suggestions.