Skip to content

Modifying a File Locally Without Updating the Remote Git Repository

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.


Previous Post
4 Lessons from a 30 Year Career in 5 minutes
Next Post
Pre-Pandemic and Post-Pandemic Job Hunting