I have a directory structure like this:
.git/
.gitignore
main/
...
tools/
...
...
Inside main and tools, and any other directory, at an
The .gitignore
of your dream seems to be:
bin/
on the top level.
[Bb]in
will solve the problem, but...
Here a more extensive list of things you should ignore (sample list by GitExtension):
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
Adding **/bin/ to the .gitignore file did the trick for me (Note: bin folder wasn't added to index).
The **
never properly worked before, but since git 1.8.2 (March, 8th 2013), it seems to be explicitly mentioned and supported:
The patterns in
.gitignore
and.gitattributes
files can have**/
, as a pattern that matches 0 or more levels of subdirectory.E.g. "
foo/**/bar
" matches "bar
" in "foo
" itself or in a subdirectory of "foo
".
In your case, that means this line might now be supported:
/main/**/bin/
Step 1: Add following content to the file .gitignore.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
Step 2: Make sure take effect
If the issue still exists, that's because settings in .gitignore can only ignore files that were originally not tracked. If some files have already been included in the version control system, then modifying .gitignore is invalid. To solve this issue completely, you need to open Git Bash or Package Manager Console (see screenshot below) to run following commands in the repository root folder.
$ git rm -r --cached .
$ git add .
$ git commit -m 'Update .gitignore'
Then the issue will be completely solved.
[Bb]in/
matches both upper and lower case