2 min read
Modifying a File Locally Without Updating the Remote Git Repository

Have you ever needed to modify a file locally without committing the changes to the remote repository?

I’m collaborating on a project where software engineers share settings. However, some settings are specific to each engineer. If we commit our custom settings, it disrupts the other engineers.

Previously, we used .gitignore and kept a local copy, but this method ignores the entire file, which isn’t ideal when some shared settings are still needed.

Thankfully, Git has a solution!

Git features an –assume-unchanged command:

git update-index --assume-unchanged <file-path>

Replace <file-path> with the path of the file whose changes you want to ignore. This command instructs Git to temporarily disregard changes to the file, which is handy for configuration files you don’t want to commit.