Lab 5: Staging Changes in Git

In this tutorial I will show you how to stage changes for later commits.

Add Changes

We have already made changes in the hello.txt file and now we need to tell git to stage the changes. Check the status after adding the changes

git add hello.txt
git status

You will see the following output:

Adding changes

The change to the hello.txt file has been staged. This means that git now knows about the change, but the change hasn’t been permanently recorded in the repository yet. You can commit the changes to store it permanently.

If you decide you don’t want to commit that change after all, the status command reminds you that the git reset command can be used to unstage that change.

All posts in this series:
Lab 1: Setup Git on your Machine
Lab 2: Create a Git Repository from Scratch
Lab 3: Check the Status of the Repository
Lab 4: Making Changes to files in the Working Directory
Lab 5: Staging Changes in Git
Lab 6: Git Staging and Commiting

Other related posts:
Git Delete a Local or Remote Branch
How to Clone a Git Repository into a Specific Folder?
Change the URI for a Remote Git Repository
How to Merge a Local Git Branch with Master
How to Setup Aliases and Shortcuts for Git Commands
How to create a .gitignore file in Windows

This content has been helpful to you?

Thanks for contributing!

Yes No