How to Add Linux Executable Files to .gitignore?

前端 未结 6 857
小蘑菇
小蘑菇 2020-12-13 01:48

How do you add linux executable files to .gitignore without giving them an explicit extension and without placing them in a specific or /bin directory? Most are named the sa

6条回答
  •  春和景丽
    2020-12-13 02:35

    A way of generating differences against your .gitignore in one go from all the executable files from current dir:

    find . -perm /111 -type f | sed 's#^./##' | sort | diff -u .gitignore -
    

    this generates a diff meaning you don't lose any manual changes to the file. This assumes your .gitignore file is already sorted. The sed part just strips the leading ./ that find generates.

    There's no automatic way to ignore only executable files, so you're always going to have to man-manage the file.

提交回复
热议问题