Last active
January 31, 2022 02:02
-
-
Save bitdivine/38603a2da5f3877a37de5be121636d18 to your computer and use it in GitHub Desktop.
Convert .gitignore files in a repo into a dockerignore file
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
git ls-files --recurse-submodules --full-name |\ | |
awk -F/ '($(NF) == ".gitignore")' |\ | |
xargs -I{} awk -vx="{}" 'BEGIN{gsub(/[.]gitignore$/,"", x)}/^ *#/{print;next}/./{print x$0}' "{}" |\ | |
awk 'BEGIN{print ".git"}{print}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment