Git – Difference Between ‘assume-unchanged’ and ‘skip-worktree’

I have local changes to a file that I don’t want to commit to my repository. It is a configuration file for building the application on a server, but I want to build locally with different settings. Naturally, the file always shows up when I do ‘git status’ as something to be staged. I would like to hide this particular change and not commit it. I won’t make any other changes to the file.

To clarify, using .gitignore is not what I want since that only prevents new files from being added. I want to ignore changes to a file already in the repository.

After some digging around, I see 2 options: assume-unchanged and skip-worktree. A previous question here talks about them but doesn’t really explain their differences.

How are the two commands different? Why would someone use one or the other?

2 s
2

Leave a Comment