I have a directory in the format: ~/models/*/*, where the second * represents 220 directories named hmm0 to hmm220.
I only want to include the last directory in the commit, which I have managed to do with the .gitignore file using a sequence of ! and ignore lines (this already works):
!models/
models/*
!models/*/
models/*/*
!models/*/hmm220/
However, the issue is that the number of directories can change. For example, I may have 240 directories the next time named from hmm0 to hmm240. I want to always only take the last directory (and ignore previous ones). Is this possible, and if so how? If not, is there a better solution than just having to change the .gitignore file each time the number of directories change?
I would readjust the
modelsdirectory, so to keep the important one incurrentand don't sync the archives.In your code you would then implement something like(not working BASH ;) ):