Home » Git » How to see a list of staged changes in Git

How to see a list of staged changes in Git

When you’ve made a lot of changes to a lot of files in your git repo, and you have them staged, you may very well want to check the lost of files that you’ve staged before you commit those changes to the repo. You might not want to see untracked files in the list, just the ones that have been staged already.

To see a list of staged changes, type:

git diff --staged

This lists the files which have been staged, and shows the changes which have been made. If you have one file staged then it’s useful, if you have staged a LOT of files then it isn’t so clear. In this case, to list staged files in git, use:

git diff --name-only --staged

Using the --name-only flag shows only the name of the changed files.

If you don’t know what ‘stage a change’ means then check out my post ‘What is git’ which is a plain English explanation.

Also remember that you can use git status to see a summary of the current state of your repo, including seeing untracked files, files which have changed but are not staged, and files which are staged for commit.

Summarising

To see what you have changed but not yet staged:

git diff

To see what you have staged (and therefore what will go in your next commit):

git diff --staged