We have successfully commanded Git to ignore the temporary file created by the Word application. Go ahead and refresh your GUI or get the status from your CLI now. The only addition to your content.docx
file in the Unstaged Changes area would be the .gitignore
file and not the temporary file.
Every time Git wants to check for new files (untracked changes) present in the repository it checks with the .gitignore
file for exclusions. By observing the temporary file's name (~$ontent.docx
) we can guess that any temporary file created by Word is going to start with the special character ~ so we put an entry in .gitignore
to match all files starting with that character. The very entry ~*.*
under the .gitignore
file says to exclude any filename starting with the character ~ with any extension.
At any given point of time before committing, if you want to move a file from the Staged Changes to the Unstaged Changes area you can do the following:
git reset filename.extension
18.223.125.219