I have a bunch of files in a changeset, but I want to specifically ignore a single modified file. Looks like this after git status
:
# modified:
Now git
supports exclude certain paths and files
by pathspec magic :(exclude)
and its short form :!
. So you can easily achieve it as the following command.
git add --all -- :!main/dontcheckmein.txt
git add -- . :!main/dontcheckmein.txt
Actually you can specify more:
git add --all -- :!path/to/file1 :!path/to/file2 :!path/to/folder1/*
git add -- . :!path/to/file1 :!path/to/file2 :!path/to/folder1/*
For Mac and Linux, surround each file/folder path with quotes
git add --all -- ':!path/to/file1' ':!path/to/file2' ':!path/to/folder1/*'