How do you ignore a file in Git without deleting it?
a) Add the file to
.gitignoreb) Use
git rm --cached filenamec) Delete the file locally
d) Use
git reset filenameAnswer:
a) Add the file to
.gitignoreExplanation:
To ignore a file in Git without deleting it, you can add the file to the .gitignore file. This prevents Git from tracking changes to the file in future commits but leaves the file intact in your working directory.
For example, adding config.php to .gitignore will prevent Git from tracking changes to config.php, while keeping it available for use locally.
This is useful for ignoring sensitive files or configuration files that should not be committed to the repository.