Git - How do I show the changes which have been staged

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

http://git-scm.com/docs/git-status http://git-scm.com/docs/git-status

http://git-scm.com/docs/git-diff http://git-scm.com/docs/git-diff

git diff [--options] [--] […] This form is to view the changes you made relative to the index (staging area for the next commit). In other words, the differences are what you could tell git to further add to the index but you still haven t. You can stage these changes by using git-add(1).

Unfortunately, I can t quite make sense of this. There must be some handy one-liner which I could create an alias for, right?

Answers

It should just be:

git diff --cached

--cached means show the changes in the cache/index (i.e. staged changes) against the current HEAD. --staged is a synonym for --cached.

EDIT

Just to clarify the above statement, --staged and --cached does not point to HEAD, just difference with respect to HEAD. If you cherry pick what to commit using git add --patch (or git add -p), --staged will return what is staged.

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/1587846/how-do-i-show-the-changes-which-have-been-staged

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils