How to Add Linux Executable Files to .gitignore?

前端 未结 6 858
小蘑菇
小蘑菇 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:41

    I too was trying to figure out this very question several times. Wanna share a solution that stuck for long. Though I am writing this from the Go perspective, but otherwise I believe this is generally applicable.

    First, the observation is that there are much fewer executables (and/or binary) files in typical project, then everything else. Also, worth noting, that the approach to instead explicitly mark source files "to not ignore", and ignore everything else, doesn't work well, because we want our comments and text files, e.g., be git'ed too.

    So the solution was to make a convention that executables have .e suffix, and .gitignore has *.e in it.

    It is simple, and works well.

提交回复
热议问题