I would like to understand what Git is actually stored when moving files to the "intermediate" state.
Consider the following sequence:
A new file is added and committed to the local repository:
touch file.txt git add file.txt git commit
I am making changes to the file:
echo text1 > file.txt git add file.txt
Then I edit the file again before committing it:
echo text2 > file.txt
A git status shows:
# On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: file.txt # # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: file.txt #
Then I commit the file:
git commit file.txt
How does Git handle the new, second update of file.txt without the knowledge? The "status" output looks as if he tried to check the first revision, but without saving the uninstalled changes, without checking them.
Is there an implicit step that is performed in this case?
git
Nick S.
source share