You know when you start off building a kernel after creating a default .gitignore file containg list of object files and other temp files to be ignored, and at the end of a compilation, when you run a “git status”, you get a long list of new files that arent necessary to be included in the git. Manually adding them without wildcards is a headache. If you do add them with wildcards, you may potentially have conflicts with essential source scripts.
In this case, you can use the list output by git to your advantage.
You can just pipe the “git status” output to a file, and use it to add to your .gitignore.
Eg:
git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: .gitignore # modified: include/config/kernel.release # modified: include/generated/compile.h # modified: include/generated/utsrelease.h # modified: scripts/basic/fixdep # modified: scripts/conmakehash # modified: scripts/kallsyms # modified: scripts/kconfig/conf # modified: scripts/mod/elfconfig.h # modified: scripts/mod/mk_elfconfig # modified: scripts/mod/modpost # modified: scripts/recordmcount # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # ..tmp_vmlinux1.cmd # ..tmp_vmlinux2.cmd # .missing-syscalls.d # .tmp_System.map # .tmp_kallsyms1.S # .tmp_kallsyms2.S # .tmp_versions/ # .tmp_vmlinux1 # .tmp_vmlinux2 # .vmlinux.cmd # System.map # arch/arm/boot/.Image.cmd # arch/arm/boot/.zImage.cmd # arch/arm/boot/compressed/.piggy.lzma.cmd # arch/arm/boot/compressed/.vmlinux.cmd # arch/arm/boot/compressed/lib1funcs.S # arch/arm/boot/compressed/piggy.lzma # arch/arm/boot/compressed/vmlinux.lds # arch/arm/common/modules.builtin
Capture it to a file pipe.
git status > ../unnecessary.txt
cat ../unnecessary.txt | awk '{for(i=3;i<=NF;++i)print $i}'
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
He is a full stack developer, whose favorite languages are currently Python and Vue.js. He is also fluent in Javascript, Flutter/Dart, Perl, PHP, SQL, C and bash shell scripting. He loves Linux, and can often be found tinkering with linux kernel code, and source code for GNU applications. He used to be an active developer on XDA forums, and his tinkered ROMS used to be very popular in the early 2000s.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.