Git tricks: How to ignore files locally

Santiago Álvarez
2 min readAug 22, 2023

This git trick could be useful if you want to have some files in your coding project to be modify in your local but you don´t want to push those changes into your code repository. For example I used it for some config files in my Python backend projects that use with personal settings.

A practical example taking into account that you have a file in the following path of your project app/config_saaf.json that you don´t want to bee tracked by git in order to avoid to push the changes.

  1. Navigate to .git/info in your root path folder.
cd .git/info

2. Open the file exclude using vi:

vi exclude

3. Add the path you want to exclude in the file pressing “i” key:

4. Save the file pressing “Esc” and then typing “:wq!” and press “Enter”.

After that run the following command:

# General structure: git update-index --skip-worktree <path_name>
git…

--

--