If I don\'t want .html files tracked I can add the pattern to .gitignore and they\'ll be ignored. I\'d like to know how I can do the converse - at checkout, how could I ask git
If you want just a one-time change (or not consistent) or you just don't want to put files in .gitignore
then do the below:
checkout
git stash push -m "files_to_ignore" my/path/of/the/file/file.txt
git checkout .
git stash apply stash^{/files_to_ignore}
The complete solution using git aliases can look like this:
alias reset-non-dev='git stash push -m "ignore_files" MyRepo/file1.txt MyRepo/dir/file2.js MyRepo/dir/dir2/file3.cs PSOne/Startup/PSOne/Views/Login.xaml.cs ; git checkout . ; git stash apply stash^{/ignore_files} ;'
Later you can use this alias simply by putting its name in git bash and hitting enter.
One benefit here that I observed is that with this approach you can change the files or skip them whenever you really need it and not marked such files as always ignored.