- diff
- --cached|diff
Making some changes
- edit the README.txt file again, adding a new row.
- $ git status
- $ git diff
- $ git add README.txt
- $ git status
- $ git diff
- $ git$ git diff --cached (or --staged)
$ git status
examples/out/status_03.txt
# On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: README.txt # no changes added to commit (use "git add" and/or "git commit -a")
What has changed?
$ git diff
WARNING: terminal is not fully functional diff --git a/README.txt b/README.txt index e51ca0d..a697828 100644 --- a/README.txt +++ b/README.txt @@ -1 +1,2 @@ -Hello Git +Hello Git +Second line
$ git add README.txt $ git status
examples/out/status_05.txt
# On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: README.txt #
What did we change?
$ git diff $ git diff --cached (or --staged)
WARNING: terminal is not fully functional diff --git a/README.txt b/README.txt index e51ca0d..62567d0 100644 --- a/README.txt +++ b/README.txt @@ -1 +1,2 @@ -Hello Git \ No newline at end of file +Hello Git +Second line
$ git commit -m "update README"
[master 1251a45] update README 1 file changed, 2 insertions(+), 1 deletion(-)