What is the difference between git add filename
and git stage filename
? Because when I tried them both it looks that they do the same thing.
To add to torek's answer, that synonym was introduced in commit 11920d2 (git 1.6.1-rc2, Dec. 2008)
Add a built-in alias for '
stage
' to the 'add
' commandThis comes from conversation at the GitTogether where we thought it would be helpful to be able to teach people to 'stage' files because it tends to cause confusion when told that they have to keep 'add'ing them.
This continues the movement to start referring to the index as a staging area (eg: the
--staged
alias to 'git diff
'). Also adds a doc file for 'git stage
' that basically points to the docs for 'git add
'.
That latter influenced the git status
output, in commit 8009d83, git 1.7.4-rc0, Nov 2010.
The message "Changed but not updated
" was rewritten into "Changes not staged for commit
"
Better "
Changed but not updated
" message ingit status
Older Gits talked about "updating" a file to add its content to the index, but this terminology is confusing for new users.
"to stage
" is far more intuitive and already used in e.g. the "git stage
" command name.
As the documentation says, git stage
is just a synonym for git add
, so there is no difference in usage.