Let's see what happens after editing the text file...URL copied
C:\...\gittut>more my.txt
First line, nothing more!! :3
Second line... ADDED!
There was a modification in the first line ':3' and a second line was added.
C:\...\gittut>git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: my.txt
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: my.txt
Git notifies the modification that happend with respect to the state when a file was added. This is because, the moment we add a file (to what is called as a stage), it freezes the state of the file for a possible commit. And any modifications after add -ing a file will not be committed in the future. add functions as a soft commit where if a code goes awry after modification, one could always go back to the state when it was add -ed. git checkout my.txt would essentially revert back the text file to the state when it was added for staging.
C:\...\gittut>git checkout my.txt
C:\...\gittut>more my.txt
First line, nothing more!!
And this way, it is always possible to revert a dysfunctional code back to a working state (given you add the file to stage everytime a code works just fine). There's your backup isn't it!?
Of course! We've just scratched the surface of the shell. We barely tickled the tentacles and hardly glanced at the ginormous gizmo, which is Git. There's more to git than simple add command.