git add untracked files to ignore 1

git add untracked files to ignore

git status --porcelain | grep '^??' | cut -c4- >> .gitignore

Here is what the above code is Doing:
1. git status –porcelain: This command will list all the files that are not tracked by git.
2. grep ‘^??’: This command will filter out all the files that are not tracked by git.
3. cut -c4-: This command will remove the first two characters from the output of the previous command.
4. >> .gitignore: This command will append the output of the previous command to the .gitignore file.

Similar Posts