I have a git repository. It contains many directories and files.
I want the repository to include only:
- certain directories (bin, Documents);
- all files that are in the root directory.
My .gitignore now looks like:
/* !/bin !/Documents /Documents/ViberDownloads /Documents/.~lock* !/.gitignore !/.bash_aliases !/.bash_history !/.bashrc !/.gitconfig !/.profile First, I exclude everything /* .
Then I add the bin and Documents directories to the white list.
I ViberDownloads certain data from these subdirectories ( ViberDownloads subdirectory and LibreOffice temporary files).
Now I manually add files from the root directory one by one.
But I have a lot of such files. Is there really no easier way to add all the root files?
git statuson the command line, I’ll getYour branch is up-to-date with 'origin/master'. If I add a new directory to the root and typegit statusagain, I’ll get the same. That is, all folders except bin and Documents will be untraceable. But I want all the files in the root to be tracked. Now this is done only for the following files:.gitignore .bash_aliases .bash_history .bashrc .gitconfig .profile. I see so far only one solution: for the remaining files, manually add the line to .gitignore. But this is a very bad decision - Yura Shinkarev.gitignorenot very desirable in this case. - Yura Shinkarev