In this post, we will understand what unstaged and staged changes w.r.t Git version control.
Unstaged vs Staged changes
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.
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.
/> git status
The above command will tell you about untracked files. You can use git add command to add files to index.
You can use Git GUI to know what files are unstaged and staged changes or the Eclipse plugin as shown in above 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 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 next commit.
Common mistake when committing changes to git repository happens when we try to commit empty index. i.e when there are no staged changes. Commit will not happen as there is nothing to commit.