Search code examples
git

what to do when you don't want a specific file to be tracked by git


when you're working in a important file like having api's .That do not want to track by a git , so what to do when you don't want to track a particular folder

i've tried .<file_name> , node_module/ in the file which i don't want to track , but unfortunately it don't work


Solution

  • Create a file named .gitignore in your top level directory then put the folders you want to ignore in it, one per line. Like:

    node_modules/
    

    Git will now ignore all folders named node_modules.

    You can also specify individual files or wildcard patterns. See https://git-scm.com/docs/gitignore.

    You should commit your .gitignore file to version control.