How do I ignore all files in a folder with a Git repository in Sourcetree?
Solution 1:
For Sourcetree users: If you want to ignore a specific folder, just select a file from this folder, right-click on it and do "Ignore...". You will have a pop-up menu where you can ignore "Ignore everything beneath: <YOUR UNWANTED FOLDER>"
If you have the "Ignore" option greyed out, you have to select the "Stop Tracking" option. After that the file will be added to Staged files with a minus sign on red background icon and the file's icon in Unstaged files list will change to a question sign on a violet background. Now in Unstaged files list, the "Ignore" option is enabled again. Just do as described above.
Solution 2:
Add this to .gitignore:
*
!.gitignore
Solution 3:
Right click on a file → Ignore → Ignore everything beneath.
If the Ignore option is grayed out then:
- Stage a file first
- Right click → Stop Tracking
- That file will appear in the pane below with a question mark → Right click on it→ Ignore