Is there a way to gitignore files for a selected duration?
I'm aware that we can use git update-index --assume-unchanged
as mentioned here. But
- using this method, I need to manually set & unset this, so there's a chance that I might forget to unset.
- more importantly, its not a recommended approach as documented in git-scm - (thanks to bk2204's comment below for the reference)
So, I'm looking for a way to automatically start including the files in git changes.
The use-case here is that I use Obsidian which is a Personal Knowledge Management application. And this applications saves the configuration setting of the UI layout in a json format anytime I open a file. It keeps track of
- all the currently active files and top 10 recently opened files which constantly change and I don't want that to trigger the git change
- the layout of the application (similar to VS Code workspace layouts) - which I need to save whenever its changed
So I don't want to include them in git changes regularly, but I want to include them at-least every 2 days to ensure that any layout changes are included.
How do I achieve this?
To add more clarity based on the comments:
The challenge is not to commit them on a regular basis, it is to ignore the files whenever I commit in the 2 days span. The reason for that is that I have been using
git add .
orgit commit -a -m 'My commit comments'
as a practice for a very long time. And it has become second nature to me at this point. And I want git to ignore these files when I do that within the span of 2 days.So an ideal solution would mean that I don't have to keep a lookout for these files every time I commmit and manually ignore them and then manually add them the 2nd day - since they will be automatically un-ignored the 2nd day
The use-case I mentioned above is just one example, there can be other use-cases like that for other kind of tools. So i'm looking for a solution using git workflow.