For ease of work I do some local hacks to my code that I do not wish to have commit.
For example, I might have some tests that are expensive to run locally and I always have them skipped so that they only run on the CD Pipeline.
Or maybe, I hardcode the response of an API to check the UI consistently without dependency on the backend.
Whenever I'm adding my real changes I do git add -p
and consistently ignore these hacks, but work is pretty menial.
Is there a way to tell git something like, hey these changes I want to be always ignored. It could prompt me if I modify anything else on the files but not prompt me if I don't. Or maybe never ask for that blob unless it changes.
Of course I cannot just add them to .gitignore, they are important files that I want in my repository.
It is related to this question Git - Difference Between 'assume-unchanged' and 'skip-worktree' but in the linked questions the files that are ignored will never be modified.
In my case I do modify those files, but I want to review only when I do changes different from the ones that I already declined.