Unstaged and Staged changes in Git [ 2024 ]
Unstaged and Staged changes in Git
Git is a distributed version control system that tracks changes to files and coordinates work among multiple people. It allows you to commit, branch, and merge changes efficiently in a collaborative environment. In this post, we will understand what unstaged and staged changes w.r.t Git version control.
Unstaged Changes
Unstaged changes are modifications made to files in your working directory that have not yet been marked for inclusion in the next commit. These changes are local and can be seen using the git status command.
Unstaged changes are changes that are not tracked by the Git. For example, if you copy a file or modify the file. Git maintains a staging area(also known as index) to track changes that go in your next commit.
For example:
You edit a file called sample.txt. If you check the status with git status, you’ll see that sample.txt has been modified but not staged.
Staged Changes
Staged changes are modifications that have been marked to be included in the next commit. When you stage a change, you’re telling Git that you want to include this change in your next commit. You can stage changes using the git add command.
After editing sample.txt, you use git add sample.txt. This moves the changes to the staging area also called the index. Now, if you run git status
command, you’ll see that sample.txt is in the staging area, ready to be committed.
The staging area is a file, in your Git directory, that stores information about what will go into your next commit. Staging the changes will put the files into the index. The next git commit will transfer all items from staging into your repository.
Command-line
/> git status
The above command will tell you about untracked files. You can use git add command to add files to the index.
Git GUI
You can use Git GUI to know what files are unstaged and staged changes or the Eclipse plugin as shown in the picture.
/> git gui
Git gui show unstaged/staged changes and you can move files between stage/unstage by using the menu items in the UI.
If you use the Eclipse plugin, you add the files that you wish to commit to the index. Right-click >> Choose Add to index option. Once you have added, you can see that the files will be staged for the next commit.

Common mistake
The common mistakes when committing changes to the git repository happens when we try to commit an empty index. i.e when there are no staged changes. Commit will not happen as there is nothing to commit.
Stashing Changes it Git
Git Tutorial Links
For more information on Git tool, visit the official website: