Loading
Current section: Commands 17 exercises
lesson

Git Tracking and Staging Files

When we ran git status inside of our repository in our previous lesson , we were told that there is nothing to commit, and that we should make files and add them. So let's do that!

Create Files with echo

The echo command can be used to write text into new files.

The following commands wi

Loading lesson

Transcript

00:00 When we ran git status inside of our repository, we were told that there is nothing to commit, and that we should make files and add them. So let's do that. Let's echo a githelp heading into a githelp.txt file and repeat that for init and status.

00:20 Typing ls we should see three files. Let's run git status again. We have a new category now for untracked files. We can add them with the git add subcommand. Let's do that with a file name like it's suggesting here. git add githelp.txt. Run git status again. Now we have an additional

00:39 section, changes to be committed. Note that these aren't committed yet, but they're staged for commit. If we want to stage the rest of these files, we can do them individually with git add, but we can use the dot shortcut to add everything that hasn't been added to the index. Finally,

00:56 run git status one last time to see that everything has been moved into our index and staged for commit.