See the changes
Make some changes to the config.pl file and stage it.
$ notepad config.pl $ git status
examples/out/status_09.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 # modified: config.pl # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # setup.pl no changes added to commit (use "git add" and/or "git commit -a")
$ git add config.pl $ git status
examples/out/status_10.txt
# On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: config.pl # # 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 # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # setup.pl
So what was changed?
$ git diff
diff --git a/README.txt b/README.txt index 62567d0..fb89137 100644 --- a/README.txt +++ b/README.txt @@ -1,2 +1,4 @@ Hello Git Second line +Third line
Only the changes to the not staged files are shown
$ git diff --cached ( or --staged)
diff --git a/config.pl b/config.pl
index f9d55cd..e2b7f47 100644 --- a/config.pl +++ b/config.pl @@ -1 +1,2 @@ # this is the config.pl file +# second line
Only the changed to the staged files are shown
$ git diff HEAD
diff --git a/README.txt b/README.txt index 62567d0..fb89137 100644 --- a/README.txt +++ b/README.txt @@ -1,2 +1,4 @@ Hello Git Second line +Third line + diff --git a/config.pl b/config.pl index f9d55cd..e2b7f47 100644 --- a/config.pl +++ b/config.pl @@ -1 +1,2 @@ # this is the config.pl file +# second line
changes between working copy and HEAD