Last active
December 9, 2022 20:37
-
-
Save martinboy/04bfef054d4b0abd75a920b680d1e710 to your computer and use it in GitHub Desktop.
Add all symlinks to a .gitignore file that aren't in there already.
This file contains 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
#!/bin/sh | |
# | |
# The command should be run in the git repository root. | |
# It adds all symlinks to a .gitignore file that aren't in there already. | |
for f in $(git status --porcelain | grep '^??' | sed 's/^?? //'); do | |
if test -L "$f" | |
then | |
test -L "$f" && echo $f >> .gitignore; | |
elif test -d "$f" | |
then | |
find ${f%/} -type l -not -exec grep -q "^{}$" .gitignore \; -print >> .gitignore | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on my answer on StackExchange
Found it very useful when deploying Magento extensions via Modman or Composer
Thanks to @colinmollenhour and @VinaiKopp