how to add all currently untracked files/folders to git ignore?
Try this: git status -s | grep -e “^\?\?” | cut -c 4- >> .gitignore Explanation: git status -s gives you a short version of the status, without headers. The grep takes only lines that start with ??, i.e. untracked files, the cut removes the ??, and the rest adds it to the .gitignore file.