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 same as the C file from which they were compiled without the ".c" extension.
相关问题
- Sorting 3 numbers without branching [closed]
- Multiple sockets for clients to connect to
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
Can you ignore all, but source code files?
For example:
I wrote a script to automatically add ELF executables to
.gitignore
.git-ignore-elf
:Features:
This single-script version is here: http://sam.nipl.net/b/git-ignore-elf-1
Here is a more modular version, which depends on other scripts (git-root, find-elf, uniqo) from the same place: http://sam.nipl.net/b/git-ignore-elf
I would explicitly put them in the project .gitignore. It's not elegant, but I imagine your project doesn't have that many of them.
A way of generating differences against your
.gitignore
in one go from all the executable files from current dir: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.
Most developers usually have a
build
directory in their project where the actual build process in run. So, all executables,.o
,.so
,.a
, etc. are there and this build directory is added into the.gitignore
.