![]() |
In Git, keeping your repository clean and organized is crucial. Sometimes, you might have files that were accidentally committed but shouldn’t be tracked by Git. This article explores effective methods to handle such situations and prevent these files from being tracked in the future. Table of Content Removing the file from Git’s Tracking (keeping it Locally)
git rm --cached <filename>
![]() git rm –cached new.html Adding a Pattern to your .gitignore file
Example:Imagine you want to ignore a file named “config.txt” and any files ending in “.log”.
config.txt ![]() Now, Git won’t track any changes made to “config.txt” or future files with the “.log” extension. |
Reffered: https://www.geeksforgeeks.org
Git |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |