In order for the files not to be processed, they need to be added to the gitignore file. Is it possible to do the opposite, that is, for example, to indicate that it is necessary to process such a file, and do not take the rest into account.
2 answers
In .gitignore you can invert the rules with ! :
* !*.html Now git will ignore all files except those that fall under the *.html pattern.
.gitignore documentation
|
You can simply not use commands like git add .and add files only one by one.
You can also write to .gitignore * (i.e., all files), and add them one by one through git add -f
Do not forget that a file that is already in the repository will be tracked no matter what is written in .gitignore
- then manually have to view the list of changes and there is a chance to make a mistake. - perfect
- @perfect yes, exactly. So, the first option is removed. Although the list of changes personally, I always look manually. - Pavel Mayorov
- and the forced addition will work with the empty list of changes? - perfect
- @perfect Why not? - Pavel Mayorov
- I just don’t know what the force mode is for - perfect
|