Created
January 22, 2019 07:22
-
-
Save numpde/3166fbaec478ec17d13dfda93bc5b978 to your computer and use it in GitHub Desktop.
A mechanism to .gitignore large files but keep a list of them on git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| help: | |
| @echo Put this script at the root of the git project. | |
| @echo | |
| @echo Add the following lines to the .gitignore file: | |
| @echo " ""**/UV/**" | |
| @echo " ""!**/UV/unversioned" | |
| @echo | |
| @echo Run | |
| @echo " ""make unversioned" | |
| @echo to create the listings of unversioned files in | |
| @echo " ""**/UV/unversioned" | |
| @echo and stage these for commit. | |
| mark_unversioned: | |
| @echo ----------- | |
| find -name 'UV' -type d | sed 's|.*|&/unversioned|' | xargs -L1 touch | |
| find -name 'unversioned' | xargs git add | |
| @echo ----------- | |
| git status | |
| unversioned: | |
| make mark_unversioned | |
| for f in $$(find -name 'unversioned' -type f); do \ | |
| d=$$(dirname $$f); \ | |
| echo $$d; \ | |
| LANG=US.UTF-8 ls -al $$d | grep -v ' [\.]*[ ]*$$' | cut -d ' ' -f 5- | grep -v ' unversioned[ ]*$$' > $$f; \ | |
| cat $$f; \ | |
| done | |
| git commit -m "(listing unversioned directories)" $$(find -name 'unversioned' -type f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment